[BUG] Auto-update creates broken claude.exe symlink on macOS, leaving CLI unusable after restart
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
After Claude Code auto-updates in the background, the global claude symlink is recreated pointing at a Windows binary path (claude.exe) that does not exist on macOS. As a result, any attempt to run claude from the terminal fails with zsh: permission denied: claude.
Inspecting the symlink:
$ ls -la /Users/me/.nvm/versions/node/v22.22.0/bin/claude
lrwxr-xr-x 1 me staff 60 May 7 03:16 .../bin/claude -> ../lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe
What Should Happen?
On macOS, the global claude symlink should point at the macOS entrypoint (e.g. cli.js or the equivalent JS entrypoint resolved from package.json's bin field), not at claude.exe. The CLI should remain runnable across restarts without manual reinstallation.
Error Messages/Logs
$ claude
zsh: permission denied: claude
$ claude -c
zsh: permission denied: claude
$ ls -la /Users/me/.nvm/versions/node/v22.22.0/bin/claude
lrwxr-xr-x 1 me staff 60 May 7 03:16 /Users/me/.nvm/versions/node/v22.22.0/bin/claude -> ../lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe
$ type -a claude
claude not found
Steps to Reproduce
- Install Claude Code globally:
npm install -g @anthropic-ai/claude-code(Node v22.22.0 via nvm, macOS). - Use Claude Code normally for several days with auto-updates enabled (default).
- Restart the machine.
- Open a new terminal session and run
claude. - Observe:
zsh: permission denied: claude. - Inspect the symlink and observe it now points at
claude.exe, which does not exist on macOS.
Workaround that restores functionality (until the next auto-update repeats the bug):
rm -rf ~/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/claude-code
rm -rf ~/.nvm/versions/node/v22.22.0/lib/node_modules/@anthropic-ai/.claude-code-*
npm install -g @anthropic-ai/claude-code
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.133 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- Node installed via nvm; v22.22.0 active. Other versions installed (v18.17.0, v20.19.5) but not in use.
- Conda also initialized in shell (base env active), shouldn't be relevant but mentioning in case PATH ordering matters.
- The symlink mtime updates without me running any install command, which is what points at the auto-updater.
- Likely fix area: the platform-detection branch in the auto-update flow appears to be selecting the Windows
binentrypoint (claude.exe) on macOS. Worth checking how the updater resolves thebinfield from package.json vs. how the initialnpm install -gresolves it — the initial install gets it right, the updater does not. - Happy to provide full
~/.npm/_logs/output, the resolved package.jsonbinfield, or run any diagnostic commands if useful.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗