I Got Tired of Claude Code Update Errors, So I Wrote a Fix

Kept running into update errors every time Claude Code had a new release.

Tried everything — uninstall, reinstall, --force, you name it.

The only thing that worked consistently was manually deleting the global install and starting fresh.

rm -rf ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code 
rm -f ~/.npm-global/bin/claude

So I wrote myself a little update-claude script and added it to my .zshrc.

Now I just run:

update-claude

And everything Just Works™ again.

Here’s the alias, if it helps anyone else:

alias update-claude='rm -rf ~/.npm-global/lib/node_modules/@anthropic-ai/claude-code && rm -f ~/.npm-global/bin/claude && npm install -g @anthropic-ai/claude-code'