Description
When running Claude Code via the Claude Desktop app on macOS (Apple Silicon), the env block in ~/.claude/settings.json is not applied to Bash tool commands. Shell profile files (.zshenv, .zprofile, .zshrc) are also not effective at setting PATH for the Bash tool, despite the subprocess being zsh.
Environment
- macOS (Darwin 25.4.0, Apple Silicon)
- Claude Desktop app (
CLAUDE_CODE_ENTRYPOINT=claude-desktop)
- Shell:
/bin/zsh
Current PATH in Bash tool
/Users/<user>/.asdf/shims:/opt/homebrew/opt/asdf/libexec/bin:/usr/bin:/bin:/usr/sbin:/sbin
Missing: /opt/homebrew/bin, /opt/homebrew/sbin, ~/.cargo/bin
What I tried
-
env block in ~/.claude/settings.json — documented at https://code.claude.com/docs/en/settings but has no effect:
{
"env": {
"PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/Users/<user>/.asdf/shims:/opt/homebrew/opt/asdf/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
}
}
-
SessionStart hook writing to CLAUDE_ENV_FILE — hook never executes in Desktop app sessions.
-
~/.zshenv with explicit export PATH=... — the subprocess IS zsh, and HOMEBREW_PREFIX from brew shellenv IS set, but PATH additions from .zshenv are not present. Likely overridden by path_helper in /etc/zprofile or by the Desktop app itself.
-
~/.zprofile with explicit export PATH=... — no effect, suggesting the Desktop app does not run a login shell.
Evidence that shell config partially works
HOMEBREW_PREFIX=/opt/homebrew IS set (from brew shellenv in .zshenv)
HOMEBREW_CELLAR=/opt/homebrew/Cellar IS set
- But PATH does NOT include
/opt/homebrew/bin
- A fresh
zsh -c 'echo $PATH' subprocess launched from the Bash tool DOES show the correct PATH
Expected behavior
The env block in settings.json should set/override environment variables for Bash tool commands, as documented. Alternatively, .zshenv PATH exports should be respected.
Impact
Any Homebrew-installed CLI tools (gh, pnpm, node via Homebrew, etc.) are not available in the Bash tool without using full paths like /opt/homebrew/bin/gh.
Description
When running Claude Code via the Claude Desktop app on macOS (Apple Silicon), the
envblock in~/.claude/settings.jsonis not applied to Bash tool commands. Shell profile files (.zshenv,.zprofile,.zshrc) are also not effective at setting PATH for the Bash tool, despite the subprocess being zsh.Environment
CLAUDE_CODE_ENTRYPOINT=claude-desktop)/bin/zshCurrent PATH in Bash tool
Missing:
/opt/homebrew/bin,/opt/homebrew/sbin,~/.cargo/binWhat I tried
envblock in~/.claude/settings.json— documented at https://code.claude.com/docs/en/settings but has no effect:{ "env": { "PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/Users/<user>/.asdf/shims:/opt/homebrew/opt/asdf/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" } }SessionStart hook writing to
CLAUDE_ENV_FILE— hook never executes in Desktop app sessions.~/.zshenvwith explicitexport PATH=...— the subprocess IS zsh, andHOMEBREW_PREFIXfrombrew shellenvIS set, but PATH additions from.zshenvare not present. Likely overridden bypath_helperin/etc/zprofileor by the Desktop app itself.~/.zprofilewith explicitexport PATH=...— no effect, suggesting the Desktop app does not run a login shell.Evidence that shell config partially works
HOMEBREW_PREFIX=/opt/homebrewIS set (frombrew shellenvin.zshenv)HOMEBREW_CELLAR=/opt/homebrew/CellarIS set/opt/homebrew/binzsh -c 'echo $PATH'subprocess launched from the Bash tool DOES show the correct PATHExpected behavior
The
envblock insettings.jsonshould set/override environment variables for Bash tool commands, as documented. Alternatively,.zshenvPATH exports should be respected.Impact
Any Homebrew-installed CLI tools (
gh,pnpm,nodevia Homebrew, etc.) are not available in the Bash tool without using full paths like/opt/homebrew/bin/gh.