Claude Codeは定期的にアップデートされ、新機能の追加やバグ修正が行われています。この記事では、Claude Codeを最新版にアップデートする方法をわかりやすく解説します。
なぜアップデートが必要?
Claude Codeをアップデートすることで、以下のメリットがあります。
- 新機能の利用: 最新のAI機能や便利なコマンドが使える
- バグ修正: 既知の問題が解決される
- セキュリティ向上: セキュリティパッチが適用される
- パフォーマンス改善: 処理速度や安定性が向上
現在のバージョンを確認する
claude --version
最新バージョンはnpmで確認:
npm view @anthropic-ai/claude-code version
アップデート方法(3つの方法)
方法1: Claude Code内蔵のupdateコマンド(推奨)
claude
起動後:
/update
「Update installed, restart to apply」と表示されたら再起動。
方法2: npmコマンドで更新
npm update -g @anthropic-ai/claude-code
方法3: Homebrewで更新(macOS)
brew update
brew upgrade claude-code
OS別アップデート手順
macOS
npm update -g @anthropic-ai/claude-code
# または
brew upgrade claude-code
Windows
PowerShell(管理者として実行):
npm update -g @anthropic-ai/claude-code
Linux
npm update -g @anthropic-ai/claude-code
自動アップデートの設定
~/.claude/settings.jsonを編集:
{
"autoUpdate": true
}
アップデートできない時の対処法
「permission denied」エラー
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
npm update -g @anthropic-ai/claude-code
「command not found」エラー
.bashrcまたは.zshrcにパスを追加:
export PATH="$PATH:$(npm config get prefix)/bin"
バージョンが変わらない
hash -r # bashの場合
rehash # zshの場合
またはキャッシュクリア&再インストール:
npm cache clean --force
npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code
ダウングレード方法
npm view @anthropic-ai/claude-code versions
npm install -g @anthropic-ai/claude-code@1.0.90
よくある質問
Q: アップデートは有料? A: Claude Code自体のアップデートは無料です。
Q: データは消える? A: 通常、設定ファイルや会話履歴は保持されます。
Q: どのくらいの頻度で更新すべき? A: 週1回程度の確認をお勧めします。
まとめ
方法 | コマンド | 推奨度 |
|---|---|---|
組み込みコマンド |
| ★★★ |
npm |
| ★★★ |
Homebrew |
| ★★☆ |
最新版を使うことで、Claude Codeの機能をフルに活用できます。