fish: add ~/bin and ~/.local/bin to PATH (fixes missing starship prompt on Linux)#12
Merged
Merged
Conversation
Fish never set up PATH the way the bash/zsh stack does. rc.common prepends "$HOME/bin:$HOME/.local/bin" to PATH, but fish's config had no equivalent — only the macOS-only Homebrew shellenv block. On Linux where fish is the login shell (e.g. SSH after chsh to fish), the login PATH lacks ~/bin, so tools installed there are invisible. starship (installed to ~/bin by setup/tools.sh) couldn't be found, so `type -q starship` in config.fish was false and the prompt block was silently skipped — fish fell back to its default prompt instead of starship. Add conf.d/path.fish using fish_add_path so fish owns its PATH setup, mirroring rc.common. conf.d loads before config.fish, so PATH is ready before the starship block runs. Also drop functions/fish_prompt.fish: it was a verbatim copy of fish's built-in default prompt and only mattered as a fallback when starship was absent. It is redundant (fish's built-in default is identical) and was a red herring while diagnosing the missing prompt. https://claude.ai/code/session_01MWWuGHpDryzmyVdGGVvtZ1
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.
Problem
On a Linux box where fish is the login shell (
chshto/usr/bin/fish, reached over SSH), the starship prompt didn't load — fish showed its plain default prompt while bash on the same machine showed starship. The deeper issue: fish never set up PATH, so user-installed tools in~/binwere invisible.Root cause
The POSIX/bash/zsh stack gets its PATH from
rc.common:Fish had no equivalent — the only PATH code in fish config was the macOS-only Homebrew
brew shellenvblock. So a fish login shell on Linux started with the bare PAM//etc/environmentPATH, which lacks~/bin.setup/tools.shinstalls starship to~/bin. With~/binoff PATH,type -q starshipinconfig.fishwas false, so the starship init block was silently skipped and fish fell back to its built-in default prompt.This was easy to misdiagnose because a
fish -icsubshell spawned from bash inherits bash's PATH (which does have~/bin), so it found starship — making config.fish look correct. macOS works because starship is reachable there via Homebrew (/opt/homebrew/bin, added by the brew block).Confirmed with a clean login-like environment:
Change
home/.config/fish/conf.d/path.fish— usesfish_add_path -gp $HOME/bin $HOME/.local/binso fish owns its PATH setup, mirroringrc.common.conf.d/loads beforeconfig.fish, so PATH is ready before the starship block runs.-gkeeps it config-driven and reproducible (no per-host universal vars);fish_add_pathis idempotent.home/.config/fish/functions/fish_prompt.fish— it was a verbatim copy of fish's built-in default prompt, only relevant as a fallback when starship is absent (and identical to fish's built-in default). It was a red herring during diagnosis and is dead weight.Deploy / verify
After merge, on the Linux box:
Then a fresh login fish shows the starship prompt and
echo $PATHincludes~/binand~/.local/bin.No
setup/*.shscripts changed, sojust lint(shellcheck) is unaffected.https://claude.ai/code/session_01MWWuGHpDryzmyVdGGVvtZ1
Generated by Claude Code