Bash tool does not inherit PATH from launching shell environment

Open 💬 3 comments Opened May 29, 2026 by twz123

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

  1. Install a tool via nix profile install (or any mechanism that adds to PATH at the user level, e.g. ~/.nix-profile/bin)
  2. Confirm the tool is available in your shell: which http/home/user/.nix-profile/bin/http
  3. Launch claude from that shell
  4. Ask Claude to run the tool via the Bash tool
  5. 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.json env block (fragile, not portable) or wrapping the claude invocation with env 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.

View original on GitHub ↗

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