Claude Code 在 macOS 上自动更新失败(证书错误)以及解决
问题重述
使用 claude update 命令在 macOS 上进行 claude code 的更新时,经常出现以下两类报错:
➜ ~/ claude upgrade
Current version: 2.1.126
Checking for updates to latest version...
Error: Failed to install native update
Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest:
unknown certificate verification error
Try running "claude doctor" for diagnostics
➜ ~/ claude upgrade
Current version: 2.1.126
Checking for updates to latest version...
Error: Failed to install native update
Error: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest: The socket connection was closed unexpectedly.
For more information, pass `verbose: true` in the second argument to fetch()
Try running "claude doctor" for diagnostics
注意到此时系统的时间正确,SSL 证书也更新到了最新,所以不大可能是 SSL/TLS 出的问题。
解决方法
建议使用 Claude Code - Releases 提供的对应平台的包,手动或要求另外的 agent 进行更新。对于无法访问 Claude 的区域,同样建议使用此方式进行安装 Claude Code (而不是 npm,npm 渠道已经被 Anthropic 标记为 Deprecated)。

浙公网安备 33010602011771号