Skip to content

fix(install.sh): source uv env script after upstream installer#2297

Open
ktwu01 wants to merge 1 commit into
MoonshotAI:mainfrom
ktwu01:fix/install-sh-source-uv-env-2272
Open

fix(install.sh): source uv env script after upstream installer#2297
ktwu01 wants to merge 1 commit into
MoonshotAI:mainfrom
ktwu01:fix/install-sh-source-uv-env-2272

Conversation

@ktwu01
Copy link
Copy Markdown

@ktwu01 ktwu01 commented May 15, 2026

Summary

scripts/install.sh pipes https://astral.sh/uv/install.sh into sh, which writes the uv binary to ${XDG_BIN_HOME:-$HOME/.local/bin} and an env script alongside it, then edits shell rc files for future sessions. It does not export PATH in 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/bin is not already on the subshell's PATH (fresh container images, fresh user accounts, minimal distros), this check fails and the script aborts with Error: uv not found after installation. — even though uv was installed correctly. scripts/install.ps1 already 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/bin to 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 find kimi yet — addressing the secondary "soft failure" mode where install completes but kimi --version returns command not found.

Test plan

  • bash -n scripts/install.sh — syntax OK.
  • shellcheck scripts/install.sh — clean.
  • Verified upstream uv installer writes to ${XDG_BIN_HOME:-$HOME/.local/bin}/env (source: https://releases.astral.sh/installers/uv/latest/uv-installer.sh).
  • CI smoke test in debian:stable-slim / alpine would 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_uv branch wouldn't fire). The fix is structurally identical to the working logic in install.ps1 and mirrors what every "curl | sh" installer of this shape does (rustup's ~/.cargo/env, nvm's source line, etc.).

Fixes #2272


Open in Devin Review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] install.sh doesn't source uv's env after installing it: first-time users get "uv not found" or "kimi: command not found"

1 participant