Shell snapshot captures parent process PATH instead of login shell PATH (macOS, Claude Desktop, v2.1.87 regression)

Resolved 💬 3 comments Opened Apr 2, 2026 by e0da Closed Apr 2, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Shell snapshots generated by v2.1.87 capture the Claude Desktop parent process's minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin) instead of the login shell's resolved PATH. All user-configured PATH entries (Homebrew, pyenv, user bin dirs, etc.) are missing from Bash tool calls, causing command not found errors for most tools.

The snapshot file (~/.claude/shell-snapshots/snapshot-zsh-*.sh) ends with:

export PATH=/usr/bin\:/bin\:/usr/sbin\:/sbin

This is the bare macOS launchd default inherited by GUI apps. The snapshot correctly captures functions and aliases from the login shell's profile scripts (proving they ran), but the export PATH= line reflects the Claude Desktop parent process's environment, not the login shell's resolved PATH.

Snapshots generated by v2.1.78 contain the full login shell PATH (~30 entries). Snapshots generated by v2.1.87 contain only the 4 launchd defaults. The v2.1.78 release notes explicitly mention fixing this scenario: "Fixed Bash tool not finding Homebrew and other PATH-dependent binaries when VS Code is launched from Dock/Spotlight."

What Should Happen?

The snapshot should contain the full PATH from the login shell (Homebrew, pyenv, user bin dirs, etc.), as it did in v2.1.78. Bash tool calls should be able to find all tools the user has installed.

Error Messages/Logs

Steps to Reproduce

  1. Launch Claude Desktop from macOS Dock/Spotlight (not from a terminal)
  2. Open a Claude Code conversation
  3. Run echo $PATH via the Bash tool
  4. Observe only /usr/bin:/bin:/usr/sbin:/sbin
  5. Inspect ~/.claude/shell-snapshots/snapshot-zsh-*.sh — the export PATH= line at the end has only the 4 launchd defaults
  6. Note that functions and aliases in the same snapshot ARE correct (from profile scripts), confirming the login shell did source init files — only the PATH capture is wrong
  7. Compare with a snapshot from v2.1.78 (if available) — it contains the full login shell PATH

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.78

Claude Code Version

2.1.87

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

Entrypoint: Claude Desktop (not CLI or VS Code)

Environment: macOS 15 (Darwin 25.0.0), Apple Silicon (M4 Max), zsh 5.9

Related issues: #15128 (empty PATH on Windows/Git Bash), #19053 (malformed PATH escaping in snapshots), #3991 (Homebrew not in PATH)

Workaround: Adding a ~/.zshenv that sources the user's profile/PATH setup scripts. Since zsh -c (which Claude Code uses to run tool commands) sources ~/.zshenv but not ~/.zprofile, this ensures PATH is populated. However, the snapshot mechanism should capture the correct PATH so this workaround shouldn't be necessary.

Note on v2.1.78 fix: The v2.1.78 release notes explicitly state: "Fixed Bash tool not finding Homebrew and other PATH-dependent binaries when VS Code is launched from Dock/Spotlight." This fix appears to have regressed in v2.1.87.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗