claude update misdetects native install as npm-global, replaces it

Resolved 💬 3 comments Opened Feb 25, 2026 by 0x91 Closed Mar 1, 2026

Summary

claude update run from a native binary misdetects the installation type as npm-global, deletes the native symlink at ~/.local/bin/claude, and replaces it with an npm global install.

Environment

  • macOS (Darwin 25.3.0, arm64)
  • Native binary installed via claude install at ~/.local/bin/claude -> ~/.local/share/claude/versions/2.1.52
  • nvm installed with node v22.17.0
  • ~/.claude.json has installMethod: "native", autoUpdates: false

Steps to reproduce

  1. Install claude natively via claude install (symlink at ~/.local/bin/claude)
  2. Have nvm on PATH (no npm global @anthropic-ai/claude-code installed)
  3. Run claude update

What happens

Debug log from the session:

update: Installation type: npm-global
update: Config install method: global
Removed claude symlink at /Users/charlie/.local/bin/claude
update: Checking npm registry for latest version
update: Update method determined: global
update: Calling installGlobalPackage() for global update
update: Installation status: success

The update command:

  1. Detects the native binary as npm-global (incorrect)
  2. Deletes the ~/.local/bin/claude symlink
  3. Runs npm install --global @anthropic-ai/claude-code
  4. Overwrites installMethod to "global" in ~/.claude.json

Secondary issue: self-perpetuating cycle

Once the npm package is installed and nvm's bin directory is higher on PATH than ~/.local/bin, every subsequent session:

  1. Runs the npm version (nvm wins the PATH race)
  2. Mismatch detection resets installMethod to "global"
  3. The background auto-updater (if enabled) keeps the npm package updated
  4. Uninstalling the npm package doesn't help — the auto-updater in existing sessions reinstalls it

The native binary is effectively unreachable until the npm package is manually removed AND all existing sessions are killed.

Expected behavior

claude update should correctly detect it's running from a native binary and use the native update path. It should never delete the native symlink or fall through to npm installation.

Workaround

  1. npm uninstall -g @anthropic-ai/claude-code
  2. Ensure ~/.local/bin comes before nvm on PATH
  3. Set installMethod: "native" in ~/.claude.json
  4. Kill any existing sessions (their in-memory auto-updater can reinstall the npm package)
  5. Don't run claude update — the native auto-updater handles updates without this bug

View original on GitHub ↗

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