How to Update Claude Code: npm vs Homebrew for Managing Developer Tool Updates
Use the same update tool you used to install Claude Code. If you installed it with npm, update it with npm. If you installed it with Homebrew, update it with Homebrew. Mixing both is how your terminal turns into a tiny haunted house. Anthropic’s setup docs show npm as a common install path for Claude Code [source: Anthropic].
TLDR: For most developers, npm is the simple choice because Claude Code is often installed as a global npm package. Use npm install -g @anthropic-ai/claude-code@latest, then run claude --version. If a 12 person dev team updates once a week, using one shared method can save 20 to 30 minutes of “why is my version different?” chatter. Homebrew is great if your team already manages developer tools with brew upgrade.
The golden rule: one tool owns the update
Claude Code is a developer tool. Developer tools love to spread files around your system. That is fine until two package managers both think they are in charge.
That is when weird stuff starts.
claude --versionshows an old version.- Your update command says everything is current.
- Your terminal still runs the other copy.
- You lose 14 minutes and one small piece of your soul.
Honestly, it feels like the tool is gaslighting you. It is not. Your shell is just finding the wrong binary first.
Updating Claude Code with npm
If you installed Claude Code with npm, use npm again. This is usually the most direct path.
Run:
npm install -g @anthropic-ai/claude-code@latest
Then check it:
claude --version
If the version changed, great. Go build things. If not, check where your system finds Claude:
which claude
On some machines, npm global packages live in one folder, while your shell points to another. It drives me crazy that this can add 30 seconds to a simple update. But it is common.
npm is best when:
- You installed Claude Code with npm.
- You already use Node.js every day.
- You want the newest package fast.
- You work across macOS, Linux, or Windows with similar commands.
Small warning: npm global installs can depend on your Node setup. If your Node version is old, the update may fail. Update Node first, or use a version manager like nvm.
Updating Claude Code with Homebrew
Homebrew is the neat-freak friend of macOS developers. It wants a list. It wants a formula. It wants order. That can be lovely.
If you installed Claude Code through Homebrew, update your package list first:
brew update
Then upgrade Claude Code using the exact package name you installed:
brew upgrade claude-code
If your team uses a tap or custom formula, use that name instead. Do not guess. Check with:
brew list | grep claude
Image not found in postmeta
Homebrew is best when:
- Your whole team uses Homebrew for tools.
- You want updates grouped with other packages.
- You already run
brew upgradeevery Friday. - You prefer system-level tool control on a Mac.
Mac users who track bigger system changes may also care about macOS news and updates, since tool behavior can change after OS upgrades.
npm vs Homebrew: quick comparison
| Choice | Best for | Main annoyance |
|---|---|---|
| npm | Fast package updates and Node users | Global path issues |
| Homebrew | Mac teams with shared tool setup | Formula names and taps can vary |
The catch is simple. npm updates npm installs. Homebrew updates Homebrew installs. Do not cross the streams unless you like mystery bugs.
How to tell which one you used
Not sure how Claude Code got on your machine? Fair. Most of us install tools during a coffee break and forget the command by lunch.
Try these checks:
which claude
npm list -g --depth=0 | grep claude
brew list | grep claude
If npm finds it, update with npm. If Homebrew finds it, update with Homebrew. If both find it, pick one and remove the other. Clean beats clever.
A simple team policy
For solo developers, this is easy. Use npm unless you already have a Homebrew setup you trust.
For teams, write one tiny rule in your README:
- Install method: npm or Homebrew.
- Update command: the exact command to run.
- Version check:
claude --version. - Update day: weekly or before sprint planning.
This is the same habit you use when you verify official updates for any tool that affects real work. One source. One method. Less noise.
Image not found in postmeta
My practical pick
Use npm if you want the shortest path and you are comfortable with Node. Use Homebrew if your Mac setup already runs through Brew and your team likes one update routine.
Before major work, update Claude Code and check the version. That tiny habit can prevent odd behavior during coding sessions. It also helps teams that track many platform changes, from dev tools to Meta Ads B2B targeting updates.
Final rule: pick one manager, stick with it, and write the command down. Future you will be grateful. Present you may even keep your lunch break.