Shell snapshot missing Homebrew PATH on macOS
Bug Report: Shell Snapshot Missing Homebrew PATH on macOS
Issue
The shell snapshot created by Claude Code on macOS is missing /opt/homebrew/bin from the PATH, even though it's configured in .zprofile which should be sourced for login shells.
Environment
- OS: macOS (Darwin 25.3.0)
- Shell: zsh
- Claude Code: Running via VSCode extension
- Homebrew location:
/opt/homebrew/bin
Expected Behavior
When the Bash tool is invoked with a login shell (-l flag), it should source .zprofile which contains:
eval "$(/opt/homebrew/bin/brew shellenv)"
This should add /opt/homebrew/bin to the PATH before the snapshot is created.
Actual Behavior
Shell snapshot at /Users/ericwagoner/.claude/shell-snapshots/snapshot-zsh-*.sh contains:
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Homebrew paths are missing, causing npm, node, and other Homebrew-installed tools to be unavailable.
Shell Invocation
Commands are run as:
/bin/zsh -c -l source /Users/ericwagoner/.claude/shell-snapshots/snapshot-zsh-*.sh && ...
Impact
- Git pre-commit and pre-push hooks fail because they can't find
npx - All npm commands fail
- Requires workaround of prefixing every command with
source ~/.zshrc
Workaround
Added Homebrew initialization to .zshenv (which is sourced before .zprofile):
eval "$(/opt/homebrew/bin/brew shellenv)"
Root Cause
The shell snapshot appears to be captured before .zprofile executes, or the snapshot mechanism doesn't properly capture environment changes from eval commands.
Related
This worked correctly in previous sessions, suggesting either:
- Recent change in snapshot timing
- Change in how environment is captured
- Race condition in initialization order
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗