Skip to content

[BUG] Auto-update creates broken claude.exe symlink on macOS, leaving CLI unusable after restart #57178

Description

@yashgoenka

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions