Desktop app ignores env.PATH from settings.json (sandbox overrides)
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 4 comments · opened Apr 1, 2026 · closed Aug 25, 2026
Description
When running Claude Code via the macOS desktop app (com.anthropic.claudefordesktop), the env.PATH setting in ~/.claude/settings.json is silently ignored. The session PATH remains the minimal system default (/usr/bin:/bin:/usr/sbin:/sbin) instead of the configured value.
Steps to Reproduce
- Set
env.PATHin~/.claude/settings.json:
``json``
{
"env": {
"PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/Users/me/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
}
}
- Launch Claude Code from the desktop app (not the CLI).
- Run
echo $PATHvia the Bash tool.
Expected Behavior
PATH should be /opt/homebrew/bin:/opt/homebrew/sbin:/Users/me/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin as configured.
Actual Behavior
PATH is /usr/bin:/bin:/usr/sbin:/sbin — the macOS sandbox default. Tools like go, gh, and gcloud installed via Homebrew are not found.
Environment
- Entrypoint:
CLAUDE_CODE_ENTRYPOINT=claude-desktop - Bundle:
__CFBundleIdentifier=com.anthropic.claudefordesktop - Sandbox:
OPERON_SANDBOXED_NETWORK=1 - Platform: macOS (Darwin 25.3.0, arm64)
Notes
- Other settings from
settings.jsondo work (e.g.,permissions.allowrules are applied correctly). - Only the
envsection appears to be ignored. - The same
env.PATHsetting may work correctly when using the CLI entrypoint (claudein terminal), since the terminal inherits the shell profile. The issue is specific to the desktop app launch path. - A project-level
.claude/settings.local.jsonwith the sameenv.PATHis also ignored.
4 Comments
Related: #42248 — filed independently with additional findings that may be useful for debugging this.
Key additional data points from #42248:
launchctl setenv PATHis also ignored, even after full quit/restart with no lingering processes. However, OTHER environment variables set vialaunchctl setenvARE visible to the Desktop app (confirmed viasetin Bash tool). This suggests the Desktop app/sandbox is specifically overriding PATH while inheriting other session-level env vars./usr/local/bin/don't help — the minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin) excludes/usr/local/bintoo, not just/opt/homebrew/bin.~/.claude/shell-snapshots/contain the full correct PATH but it is not applied to the tool environment.settings.jsonenv.PATH DOES work — confirming this is Desktop-app-specific, not a settings.json parsing issue.pdftoppm(poppler) for PDF rendering, even though the binary exists and works when called via Bash with the full path.The
launchctlfinding is particularly interesting — if other env vars come through but PATH doesn't, something in the Desktop app or its sandbox is explicitly constructing/replacing PATH rather than inheriting it from the session environment.Closed #42639 as a duplicate of this. Adding context:
This is a regression. 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 regressed by v2.1.87.
The shell snapshot correctly captures functions and aliases from profile scripts (proving they ran) — but the final export PATH= line reflects the parent process's minimal PATH, not the login shell's resolved PATH.
Same issue here. macOS (Darwin 25.2.0, Apple Silicon), Claude Desktop app v1.569.0.
/Users/xxxx/.claude/settings.json has env.PATH set to include /Users/xxxx/.local/bin:/usr/local/bin, but the actual Bash session only gets /usr/bin:/bin:/usr/sbin:/sbin.
This breaks all MCP servers (e.g. uvx-based Jira/Confluence MCP) and official plugins like playwright@claude-plugins-official — they're enabled in settings but can't start because the binaries aren't found.
Was working fine last week. Confirmed regression.
(Until last week, the desktop app automatically inherited the full shell environment without any explicit env.PATH configuration in settings.json. Now it only picks up the minimal sandbox PATH.)
Related datapoint from testing this on macOS 2.1.111 today — the Desktop
envproblem extends toANTHROPIC_BASE_URL, and the mechanism appears to be explicit override in the code-tab child process, not just sandbox filtering.Setup
~/.claude/settings.local.jsonin an active project:``
json
``{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:4000",
"ANTHROPIC_CUSTOM_HEADERS": "x-litellm-api-key: Bearer <redacted>"
}
}
127.0.0.1:4000.claudefrom terminal) correctly routes to LiteLLM. Desktop code tab does not — it connects directly to160.79.104.10:443(Anthropic).What I tested
As a workaround I tried
launchctl setenv ANTHROPIC_BASE_URL http://localhost:4000then fully quit and relaunchedClaude.app. Then inspected process environments withps eww:| Process |
ANTHROPIC_BASE_URLin env ||---|---|
|
/Applications/Claude.app/Contents/MacOS/Claude(parent) |http://localhost:4000✅ inherited from launchd ||
claude.app/Contents/MacOS/claude(code-tab child) |https://api.anthropic.com❌ overridden |Other env vars (
ANTHROPIC_AUTH_TOKEN,OPERON_SANDBOXED_NETWORK=1, emptyANTHROPIC_API_KEY) pass through or are injected. ButANTHROPIC_BASE_URLis force-set on the child process.Implication
This rules out the common macOS workarounds:
launchctl setenv— parent inherits, child overridesLSEnvironmentplist — same override would fireClaude.app— sameThe only remaining technical path is a TLS-intercepting network proxy, which is not reasonable for regular use.
So in addition to
env.PATHbeing ignored,env.ANTHROPIC_BASE_URLis actively overwritten — which blocks LLM gateway / LiteLLM routing for Desktop code tab users even if the sandbox issue is fixed. Worth addressing together, or splitting out if you'd prefer a separate issue.Repro is trivial: set
ANTHROPIC_BASE_URLvialaunchctl setenv, relaunch Desktop,ps eww -p <code-tab-pid> | tr ' ' '\n' | grep ANTHROPIC_BASE_URL.