fix(shell): restore always-on PATH after macOS path_helper

path_helper runs after ~/.zshenv in login shells and puts Homebrew ahead of
fnm, pyenv, and ~/.local/bin. Re-source ~/.zshenv from ~/.zprofile and make
prepends idempotent so login and zsh -c resolve the same binaries.
This commit is contained in:
Frank Qing committed 2026-09-07 22:07:58 +08:00
1 parent 82c6a57c3a
commit 34d11b5aa4
8 files changed
+198 -73

No files matched your search

+2 -7
View File
@@ -21,13 +21,8 @@ fi
# Uncomment the following line if you would like to automatically install it
# pyenv install 3.12.0 && pyenv global 3.12.0
# Always-on fragment: ~/.config/zsh/pyenv.zsh (sourced from ~/.zshenv)
# Always-on fragment: ~/.config/zsh/pyenv.zsh (sourced from ~/.zshenv).
# Login shells re-apply it via ~/.zprofile after macOS path_helper.
curl -fsSL https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s -- zsh/pyenv
# macOS path_helper runs after ~/.zshenv in login shells, so reapply pyenv afterwards.
PYENV_LOGIN_HOOK='[[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/pyenv.zsh" ]] && . "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/pyenv.zsh"'
if ! grep -Fqx "$PYENV_LOGIN_HOOK" "$HOME/.zprofile" 2>/dev/null; then
[[ ! -s "$HOME/.zprofile" ]] || printf '\n' >> "$HOME/.zprofile"
printf '%s\n' "$PYENV_LOGIN_HOOK" >> "$HOME/.zprofile"
fi
# Drop legacy interactive-only copy if present
rm -f "$HOME/.config/zshrc/pyenv.zsh"