claude-code - 💡(How to fix) Fix [BUG] Auto-update creates broken claude.exe symlink on macOS, leaving CLI unusable after restart

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

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

Code Example

$ 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

---

$ 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

---

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
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. Install Claude Code globally: npm install -g @anthropic-ai/claude-code (Node v22.22.0 via nvm, macOS).
  2. Use Claude Code normally for several days with auto-updates enabled (default).
  3. Restart the machine.
  4. Open a new terminal session and run claude.
  5. Observe: zsh: permission denied: claude.
  6. 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 bin entrypoint (claude.exe) on macOS. Worth checking how the updater resolves the bin field from package.json vs. how the initial npm install -g resolves it — the initial install gets it right, the updater does not.
  • Happy to provide full ~/.npm/_logs/ output, the resolved package.json bin field, or run any diagnostic commands if useful.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING