How to Update Claude Code When Homebrew Won't Cooperate
If you use Claude Code via Homebrew on macOS, you might eventually run into this confusing situation:
$ claude --update
Current version: 2.1.81
Update available: 2.1.81 → 2.1.91
To update, run:
brew upgrade claude-codeSo you do what it says:
$ brew upgrade claude-code
Warning: Not upgrading claude-code, the latest version is already installedYou try the usual Homebrew tricks — brew update, brew cleanup, brew reinstall — same thing. What’s going on?
如果你在 macOS 上通过 Homebrew 安装了 Claude Code,可能会遇到这个令人困惑的情况:
$ claude --update
Current version: 2.1.81
Update available: 2.1.81 → 2.1.91
To update, run:
brew upgrade claude-code于是你照做:
$ brew upgrade claude-code
Warning: Not upgrading claude-code, the latest version is already installedbrew update、brew cleanup、brew reinstall——全都没用。到底怎么回事?
The Root Cause: Two Release Channels
Running brew info claude-code reveals the answer:
==> claude-code ✔: 2.1.81
...
==> Caveats
This cask tracks the stable release channel. In-app update notifications
default to the latest channel regardless. To align notifications with this
cask, set the auto-update channel to "stable" via /config or in
~/.claude/settings.jsonThe Homebrew cask tracks the stable release channel. But claude --update checks the latest channel by default. These are two different release trains:
- Stable: what Homebrew ships — less frequent, more tested
- Latest: what Claude’s built-in updater sees — more frequent, bleeding edge
Homebrew is correct: you have the latest stable version. Claude is also correct: there’s a newer latest version. They’re just talking about different things.
根本原因:两个发布渠道
运行 brew info claude-code 就能看到答案:
==> claude-code ✔: 2.1.81
...
==> Caveats
This cask tracks the stable release channel. In-app update notifications
default to the latest channel regardless.Homebrew cask 跟踪的是 stable(稳定版)发布渠道,而 claude --update 默认检查的是 latest(最新版)渠道。这是两条不同的发布线路:
- Stable:Homebrew 提供的版本——更新频率低,经过更多测试
- Latest:Claude 内置更新器看到的版本——更新频率高,包含最新功能
Homebrew 说得对:你已经有了最新的稳定版。Claude 也说得对:有一个更新的最新版。它们说的不是同一个东西。
Solution 1: Align the Release Channel
If you’re happy on stable, tell Claude to stop checking the latest channel. Run claude /config or edit ~/.claude/settings.json:
{
"releaseChannel": "stable"
}Now claude --update will only notify you about stable releases that match what Homebrew provides. No more false alarms.
方案一:对齐发布渠道
如果你满意稳定版,让 Claude 停止检查 latest 渠道。运行 claude /config 或编辑 ~/.claude/settings.json:
{
"releaseChannel": "stable"
}这样 claude --update 只会提示与 Homebrew 一致的稳定版更新,不再产生误导。
Solution 2: Switch to npm
If you want the latest builds immediately, bypass Homebrew entirely:
brew uninstall claude-code
npm install -g @anthropic-ai/claude-code@latestWith npm you control the version directly — no cask lag, no channel mismatch. Updates are instant: npm update -g @anthropic-ai/claude-code.
方案二:切换到 npm
如果你想第一时间获取最新版本,可以完全绕过 Homebrew:
brew uninstall claude-code
npm install -g @anthropic-ai/claude-code@latest用 npm 你可以直接控制版本——没有 cask 延迟,没有渠道不匹配。更新也很即时:npm update -g @anthropic-ai/claude-code。
Solution 3: Just Wait
The stable cask catches up eventually. If the version gap doesn’t bother you and you don’t need cutting-edge features, do nothing. The warning is cosmetic.
方案三:等待
稳定版 cask 最终会跟上。如果版本差异不影响你,也不需要最新功能,什么都不用做。这个提示只是表面上的。
Which Should You Pick?
| Approach | Best for |
|---|---|
| Align to stable | You like Homebrew managing your CLI tools and don’t need bleeding-edge features |
| Switch to npm | You want the newest version the moment it drops |
| Wait | You have better things to worry about (you probably do) |
The underlying lesson: when a tool’s built-in updater disagrees with your package manager, check which release channel each one is tracking. They’re usually both right — just looking at different sources of truth.
Encountered on macOS with Claude Code 2.1.81 (Homebrew cask) vs 2.1.91 (latest channel), April 2026.
该选哪个?
| 方案 | 适合场景 |
|---|---|
| 对齐到 stable | 你喜欢 Homebrew 管理 CLI 工具,且不需要最前沿的功能 |
| 切换到 npm | 你想要第一时间获得最新版本 |
| 等待 | 你有更重要的事情要忙(大概率是的) |
本质教训:当工具的内置更新器和你的包管理器意见不一时,检查它们各自跟踪的发布渠道。通常双方都没错——只是看的是不同的数据源。
问题环境:macOS,Claude Code 2.1.81(Homebrew cask)对比 2.1.91(latest 渠道),2026 年 4 月。