Bash tool does not inherit PATH from launching shell environment
Description
When Claude Code is launched from a shell, the Bash tool does not inherit the PATH (or other environment variables) from the parent process. This means tools that are available in the launching shell are not available in Claude Code's bash sessions.
Steps to Reproduce
- Install a tool via
nix profile install(or any mechanism that adds toPATHat the user level, e.g.~/.nix-profile/bin) - Confirm the tool is available in your shell:
which http→/home/user/.nix-profile/bin/http - Launch
claudefrom that shell - Ask Claude to run the tool via the Bash tool
- The tool is not found — Claude's bash sessions have a sanitized/reduced
PATH
Environment
- OS: NixOS
- Shell: bash/zsh with Nix profile PATH (
~/.nix-profile/bin,/run/current-system/sw/bin, etc.)
Expected Behavior
Claude Code's bash subprocesses should inherit the environment of the process that launched claude, just as any child process would by default in a Unix environment.
Actual Behavior
Claude Code spawns bash with a sanitized environment. Tools installed via user-level package managers (Nix profiles, ~/.local/bin, ~/go/bin, etc.) are not available, even though they are present in the launching shell's PATH.
Impact
- Users on NixOS (and likely other distros using per-user package management) cannot use their installed tools inside Claude Code bash sessions
- Workaround requires either hardcoding paths in
settings.jsonenvblock (fragile, not portable) or wrapping theclaudeinvocation withenv PATH="$PATH" claude(non-obvious)
Suggested Fix
Inherit the parent process environment by default, or add a setting like "inheritEnv": true to settings.json that causes Claude Code to pass the launching process's environment to bash subprocesses.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗