Grep tool: spawn 'rg' ENOENT on macOS v2.1.96 (regression of #15026)
Bug description
The Grep tool fails with ENOENT: no such file or directory, posix_spawn 'rg' on every invocation in Claude Code v2.1.96 on macOS. This is the same class of bug as #15026 / #43336, but manifesting on rg (the Grep tool) rather than pgrep.
Environment
- Claude Code version: 2.1.96
- Install method: VS Code extension (
~/.vscode/extensions/anthropic.claude-code-2.1.96-darwin-arm64/resources/native-binary/claude) - OS: macOS Darwin 25.4.0 (Apple Silicon, arm64)
- Shell: zsh
- System ripgrep:
/opt/homebrew/bin/rgv15.1.0 (Homebrew, Mach-O arm64, executable, runs standalone fine)
Error output
Every Grep tool invocation returns:
ENOENT: no such file or directory, posix_spawn 'rg'
Investigation
rgis installed and executable at/opt/homebrew/bin/rg:
````
$ /opt/homebrew/bin/rg --version
ripgrep 15.1.0
$ file /opt/homebrew/bin/rg
/opt/homebrew/bin/rg: Mach-O 64-bit executable arm64
/opt/homebrew/binIS in the Claude Code process environment perps eww:
````
$ ps eww -p <claude-pid> | tr ' ' '\n' | grep '^PATH='
PATH=/Users/.../.antigravity/.../bin:/Users/.../.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:...
The first several PATH entries include /opt/homebrew/bin, yet the spawn still fails with ENOENT.
- The CC binary bundles ripgrep statically —
stringson the native binary reveals ripgrep's code (rg::search,RIPGREP_CONFIG_PATH, full help text) AND a literalcmd=\"rg\"spawn site. So the single-file binary contains ripgrep internally but still tries to spawnrgas an external command for the Grep tool, then fails.
- The Bash tool works fine — it resolves
rgvia its interactive shell snapshot. Only the native Grep tool's spawn path fails. This mirrors #43336's finding that Bun'sspawn()uses a different PATH resolution than the shell-snapshot-backed Bash tool.
Related issues
- #15026 — canonical
spawn pgrep ENOENTon macOS, closed stale - #43336 — v2.1.91 regression of the above on
pgrep, closed as duplicate of #15026. Root cause from that report: "Bun's subprocess spawning uses a restricted PATH that doesn't include/usr/bin" - #42068 — bundled
vendor/ripgrep/arm64-darwin/rglosing execute permission (different root cause, npm install only) - #20733 — stale vendored
rgpath after native installer migration, closed as duplicate
The pattern: Bun's spawn() in the CC single-file binary on macOS uses a restricted/cached PATH that doesn't agree with the parent process's PATH. Fixed once for pgrep, regressed; now manifesting on rg. Each instance is auto-closed as a duplicate of a stale parent, and the underlying Bun-spawn-PATH issue isn't resolved. Filing a fresh report rather than commenting on the locked duplicates.
Reproduction steps
- Install Claude Code v2.1.96 via the VS Code extension on macOS (Apple Silicon)
- Install ripgrep via Homebrew (
brew install ripgrep) — present at/opt/homebrew/bin/rg - Start a Claude Code session
- Invoke the Grep tool (e.g., search for any pattern)
- Observe
ENOENT: no such file or directory, posix_spawn 'rg'
Expected behaviour
Any of:
- Use the statically-bundled ripgrep inside the CC binary (it is already linked in)
- Resolve
rgvia an absolute path using a full PATH walk at spawn time - Fall back gracefully to the bundled copy when external
rgcan't be resolved
Workaround
Use the Bash tool with explicit /opt/homebrew/bin/rg. Works, but adds friction — compound-command permission prompts, no structured output, no glob/type filters.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗