Non-interactive agent shells (Codex, Claude) skip .zshrc and never saw user-local tools installed via pipx/uv/grok. Add ~/.local/bin in .zshenv with an idempotent guard, and source optional ~/.config/zshenv.local for machine-local early env.
27 lines
1.1 KiB
Bash
27 lines
1.1 KiB
Bash
# Homebrew on macOS. .zshenv runs for every zsh (interactive, scripts, GUI-launched),
|
|
# and brew shellenv needs a readable CWD: cd to a safe dir first so launching from a
|
|
# TCC-protected directory (e.g. ~/Documents) does not break the eval or prompt for access.
|
|
if [ -x /opt/homebrew/bin/brew ]; then
|
|
eval "$(cd /tmp && /opt/homebrew/bin/brew shellenv)"
|
|
elif [ -x /usr/local/bin/brew ]; then
|
|
eval "$(cd /tmp && /usr/local/bin/brew shellenv)"
|
|
fi
|
|
|
|
# User-local binaries (pipx, uv tools, grok CLI, etc.).
|
|
# Lives here rather than .zshrc/.zprofile so non-interactive agent shells
|
|
# (Codex, Claude Code, CI zsh -c) still resolve user-installed tools.
|
|
if [ -d "$HOME/.local/bin" ]; then
|
|
case ":${PATH}:" in
|
|
*":$HOME/.local/bin:"*) ;;
|
|
*) PATH="$HOME/.local/bin:${PATH}" ;;
|
|
esac
|
|
export PATH
|
|
fi
|
|
|
|
# Machine-local early env (cargo, private PATH bits). Survives easyzsh reinstalls
|
|
# of this file. Prefer this over editing ~/.zshenv by hand.
|
|
if [ -f "$HOME/.config/zshenv.local" ]; then
|
|
# shellcheck disable=SC1090,SC1091
|
|
. "$HOME/.config/zshenv.local"
|
|
fi
|