fix(install.sh): source uv env script after upstream installer#2297
Open
ktwu01 wants to merge 1 commit into
Open
fix(install.sh): source uv env script after upstream installer#2297ktwu01 wants to merge 1 commit into
ktwu01 wants to merge 1 commit into
Conversation
The upstream uv installer (`https://astral.sh/uv/install.sh`) drops uv into ${XDG_BIN_HOME:-$HOME/.local/bin} and writes an env script to the same directory, but does NOT modify PATH in the running shell — it only edits rc files for future sessions. On systems where ~/.local/bin is not already on PATH (fresh containers, fresh user accounts, minimal distros), the immediate `command -v uv` check in install.sh fails and the script aborts with "uv not found after installation." scripts/install.ps1 already handles this on Windows by refreshing the session PATH from machine + user env after installing uv. Bring install.sh to parity by sourcing the env script uv just wrote (with a fallback to prepending ~/.local/bin to PATH for older uv installers that may not write one). Also print a closing hint so the user knows where `kimi` landed and how to source the env file if their interactive shell can't find it yet — this addresses the secondary "soft failure" mode where the script succeeds but `kimi --version` returns command-not-found in the next shell. Fixes MoonshotAI#2272
ae085ab to
d35220d
Compare
This was referenced May 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/install.shpipeshttps://astral.sh/uv/install.shintosh, which writes theuvbinary to${XDG_BIN_HOME:-$HOME/.local/bin}and an env script alongside it, then edits shell rc files for future sessions. It does not exportPATHin the running shell — that's why upstream prints "Run 'source ...' to add uv to your PATH" at the end.The current install.sh then immediately runs
command -v uv. On systems where~/.local/binis not already on the subshell's PATH (fresh container images, fresh user accounts, minimal distros), this check fails and the script aborts withError: uv not found after installation.— even though uv was installed correctly.scripts/install.ps1already handles this on Windows by refreshing the session PATH.This PR brings install.sh to parity by sourcing the env script uv just wrote, with a fallback to prepending
~/.local/binto PATH for older uv installers that may not write one. It also adds a closing hint pointing the user at the env file in case their next interactive shell can't findkimiyet — addressing the secondary "soft failure" mode where install completes butkimi --versionreturnscommand not found.Test plan
bash -n scripts/install.sh— syntax OK.shellcheck scripts/install.sh— clean.${XDG_BIN_HOME:-$HOME/.local/bin}/env(source: https://releases.astral.sh/installers/uv/latest/uv-installer.sh).debian:stable-slim/alpinewould deterministically prove the fix; happy to add it in a follow-up PR if the team wants one.Caveats
I did not execute the full installer end-to-end on this machine (uv is already installed, so the
install_uvbranch wouldn't fire). The fix is structurally identical to the working logic ininstall.ps1and mirrors what every "curl | sh" installer of this shape does (rustup's~/.cargo/env, nvm's source line, etc.).Fixes #2272