Skip to content

Fix Starship install failure: install to ~/.local/bin to avoid root escalation#1

Open
fan759 wants to merge 1 commit into
MichaelFYang:mainfrom
fan759:fix/starship-local-bin
Open

Fix Starship install failure: install to ~/.local/bin to avoid root escalation#1
fan759 wants to merge 1 commit into
MichaelFYang:mainfrom
fan759:fix/starship-local-bin

Conversation

@fan759

@fan759 fan759 commented Jun 1, 2026

Copy link
Copy Markdown

Problem

setup_ubuntu.sh step 3/8 Starship fails to install:

! Escalated permissions are required to install to /usr/local/bin
> Installing Starship as root, please wait…
x Command failed (exit code 22): curl --fail --silent --location --output /tmp/....tar.gz \
    https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-musl.tar.gz

The upstream message ("This is likely due to Starship not yet supporting your configuration") is a red herring — x86_64-unknown-linux-musl is supported (current latest v1.25.1 ships that asset), and the tarball downloads fine as a normal user. That text is just the installer's generic fallback for any download failure.

Root cause

The upstream installer defaults its bin dir to /usr/local/bin, which isn't user-writable, so it re-runs the download under sudo (Installing Starship as root…). curl exit code 22 = --fail saw an HTTP status ≥ 400 during that root-context download. Common causes: sudo strips proxy env vars (env_reset), so a corporate proxy is bypassed and the request gets a 4xx; or a transient GitHub rate-limit. The identical download succeeds as the normal user.

Fix

Pass --bin-dir "$HOME/.local/bin" to the installer so the install stays entirely in user space and never escalates to root — eliminating the failing step. That directory is already created (for the bat symlink) and is first on PATH, so it matches the script's existing conventions.

macOS uses brew install starship, so it is unaffected.

The upstream installer defaulted to /usr/local/bin, which forced a
re-run under sudo. The root-context download was failing (curl --fail
hitting an HTTP error, e.g. when sudo strips proxy env vars), while the
same download works fine as the normal user. Passing --bin-dir
$HOME/.local/bin keeps the install entirely in user space -- that dir is
already created for the bat symlink and is first on PATH.
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.

1 participant