[BUG] Shell snapshot overwrites PATH, breaking Homebrew tools (node, npm, gh)

Resolved 💬 5 comments Opened Feb 3, 2026 by wessmeister Closed Mar 4, 2026

What's Wrong?

When running Bash commands through Claude Code, tools installed via Homebrew (node, npm, gh, etc.) are unavailable because the shell snapshot explicitly overwrites PATH with a minimal value.

The user's ~/.zshenv correctly sets up Homebrew:

eval "$(/opt/homebrew/bin/brew shellenv)"

However, the shell snapshot file (e.g., ~/.claude/shell-snapshots/snapshot-zsh-*.sh) contains:

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

This line (around line 342 in the snapshot) overwrites any PATH set by .zshenv, making Homebrew-installed tools inaccessible.

What Should Happen?

Claude Code should preserve the user's PATH from their shell environment (.zshenv), or at minimum append to it rather than replacing it entirely.

Error Messages/Logs

$ node -v
(eval):1: command not found: node

$ gh --version  
(eval):1: command not found: gh

The tools exist and work fine:

$ /opt/homebrew/bin/node -v
v25.5.0

$ /opt/homebrew/bin/gh --version
gh version 2.86.0

Steps to Reproduce

  1. Install Node.js and GitHub CLI via Homebrew on macOS
  2. Ensure ~/.zshenv contains eval "$(/opt/homebrew/bin/brew shellenv)"
  3. Open Claude Code in VSCode/Cursor
  4. Ask Claude to run node -v or gh --version
  5. Observe "command not found" error

Workaround

Currently requires using full paths (/opt/homebrew/bin/node) for all Homebrew tools.

Environment

  • Claude Code Version: Running in VSCode extension
  • Platform: Anthropic API
  • Operating System: macOS Darwin 25.2.0 (Apple Silicon)
  • Terminal/Shell: zsh
  • Node: v25.5.0 (at /opt/homebrew/bin/node)
  • gh: v2.86.0 (at /opt/homebrew/bin/gh)

Additional Information

The shell is correctly identified as zsh and .zshenv is being sourced, but the snapshot's explicit export PATH=... statement runs afterward and clobbers the Homebrew PATH additions.

Relevant snapshot invocation:

/bin/zsh -c -l source ~/.claude/shell-snapshots/snapshot-zsh-*.sh && ...

The -l flag makes it a login shell which should respect user config, but the snapshot itself overrides PATH.

View original on GitHub ↗

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