6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Homebrewの `brew update` と `brew upgrade` の違いを実例で理解する

6
Posted at

Mac で開発していると、ほぼ必ず使う Homebrew。
ただ、brew update と brew upgrade の違いが曖昧なまま使っている人も多いのではないでしょうか。

この記事では、

  • brew update と brew upgrade の違い
  • 実際のターミナル実行例
  • よくある勘違いポイント

を 実例ベース で解説します。


結論を一言で

コマンド 何をするか
brew update Homebrew の レシピ情報を最新化する
brew upgrade インストール済みパッケージを 実際に更新する

brew update とは?

役割

Homebrew が参照している formula / cask の定義情報を最新化します。
内部的には GitHub からレシピを pull しているだけです。

👉 アプリやツール自体は更新されません。


実例:brew update を実行してみる

$ brew update
Updated 3 taps (homebrew/core, homebrew/cask).
==> New Formulae
node@22
==> Updated Formulae
git ✔

この状態では:

  • 「git の新しいバージョンがある」ことは 分かった
  • でも git 自体はまだ更新されていない

という状態です。


brew upgrade とは?

役割

インストール済みの formula / cask を 実際に新しいバージョンへ更新します。


実例:git を更新する

$ brew upgrade git
==> Upgrading git
  2.43.0 -> 2.44.0
==> Pouring git--2.44.0.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/git/2.44.0: 1,600 files, 46MB

この時点で、ようやく git が新しくなります。


よくある勘違い①

「brew update したのにバージョンが変わらない」

❌ 間違い
brew update は 更新情報を取得するだけ

⭕ 正解
実際に更新するには:

brew upgrade

が必要。


よくある勘違い②

「毎回どっちを打てばいいの?」

基本セット(おすすめ)

brew update
brew upgrade

もしくはまとめて:

brew update && brew upgrade

アップデート対象を確認したい場合

更新が必要なもの一覧を見る

brew outdated

出力例:

node (20.11.0) < 20.12.0
python@3.12 (3.12.1) < 3.12.2

cask(GUIアプリ)の場合

Chrome や VS Code なども更新したい場合:

brew upgrade --cask

個別なら:

brew upgrade --cask visual-studio-code

まとめ

  • brew update

    • レシピ情報を最新化するだけ
  • brew upgrade

    • 実際にツール・アプリを更新する
  • 「updateしたのに変わらない」は 仕様

Homebrew を安全・確実に使うためにも、
「update → upgrade」 の流れを意識して使いましょう。


おまけ(運用Tips)

  • CI / セットアップスクリプトでは brew update && brew upgrade
  • バージョン固定したい場合は安易に upgrade しない
  • 大規模更新前は brew outdated で影響範囲確認

Happy Brewing 🍺

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?