LoginSignup
8
8

More than 1 year has passed since last update.

Homebrewのアップデート(MacOS)

Posted at

はじめに

MacOSに導入しているHomebrewをアップデートする際の手順をまとめていければと思います。

Homebrewとは?

Homebrewとは、MacOSで動作するパッケージ管理システムになります。
Macのターミナルから簡単にソフトウェアをインストールできるようにするものになります。

今回の環境

  • MacBook Pro 2020年モデルを使用します。(macOS Monterey バージョン12.3.1)

スクリーンショット 2022-04-12 16.47.38.png

  • Homebrew 2.5.8
バージョン
ma-sato@satsuton ~ % brew --version
Homebrew 2.5.8
Homebrew/homebrew-core (git revision 76030; last commit 2020-11-03)
Homebrew/homebrew-cask (git revision bcbc7; last commit 2020-11-03)
ma-sato@satsuton ~ %

アップデート手順

以下の順番でやっていきます。

  • Homebrewのみアップデート
  • インストール済みのパッケージのアップグレード
  • アップデート後の不要ファイル削除

Homebrewのみをアップデート

1.アップデート実施

コマンド
brew update
実行例
ma-sato@satsuton ~ % brew update
--長いので省略--
You have 7 outdated formulae and 1 outdated cask installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
ma-sato@satsuton ~ % 

2.アップデート後のバージョン確認

コマンド
brew --version
実行例
ma-sato@satsuton ~ % brew --version
Homebrew 3.4.6
Homebrew/homebrew-core (git revision c199393579c; last commit 2022-04-12)
Homebrew/homebrew-cask (git revision f49a71b320; last commit 2022-04-12)
ma-sato@satsuton ~ %

2.5.8から3.4.6にアップデートされていることを確認

インストール済みのパッケージのアップグレード

コマンド
brew upgrade
実行例
ma-sato@satsuton ~ % brew upgrade
==> Upgrading 7 outdated packages:
azure-cli 2.11.1 -> 2.35.0
gdbm 1.18.1_1 -> 1.23
readline 8.0.4 -> 8.1.2
sqlite 3.33.0 -> 3.38.2
ansible 2.9.11 -> 5.6.0
openssl@1.1 1.1.1g -> 1.1.1n
python@3.8 3.8.5 -> 3.8.13
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.1.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:976185ec243284d74eb8b9c554d944cbc0208c26495193bcd28fdf12a08f134e
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:976185ec243284d74eb8b9c554d944cbc0208c26495193bcd28fdf12a08f134e?
######################################################################## 100.0%
〜長いので省略〜
Package installers may write to any location; options such as `--appdir` are ignored.
installer: Package name is PowerShell - 7.2.2
installer: Installing at base path /
installer: The install was successful.
==> Purging files for version 7.0.3 of Cask powershell
🍺  powershell was successfully upgraded!
==> Caveats
==> powershell
To use Homebrew in PowerShell, set:
  Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(/usr/local/bin/brew shellenv) | Invoke-Expression'
ma-sato@satsuton ~ %

※進捗を表すプログレスバーが表示される。

アップデート後の不要ファイル削除

以下のコマンドで古いパッケージ等を削除します。

コマンド
brew cleanup
実行例
ma-sato@satsuton ~ % brew cleanup
Removing: /Users/ma-sato/Library/Logs/Homebrew/azure-cli... (64B)
Removing: /Users/ma-sato/Library/Logs/Homebrew/gdbm... (64B)
Removing: /Users/ma-sato/Library/Logs/Homebrew/libyaml... (64B)
Removing: /Users/ma-sato/Library/Logs/Homebrew/readline... (64B)
Removing: /Users/ma-sato/Library/Logs/Homebrew/sqlite... (64B)
Removing: /Users/ma-sato/Library/Logs/Homebrew/xz... (64B)
Removing: /Users/ma-sato/Library/Logs/Homebrew/ansible... (64B)
Removing: /Users/ma-sato/Library/Logs/Homebrew/openssl@1.1... (64B)
Removing: /Users/ma-sato/Library/Logs/Homebrew/python@3.8... (3 files, 241.2KB)
Pruned 4 symbolic links and 4 directories from /usr/local
==> This operation has freed approximately 241.7KB of disk space.
ma-sato@satsuton ~ %

参考記事

Homebrew - Homebrew自身をアップデートする
Homebrewをアップデートするにはbrew updateコマンドを実行します

8
8
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
8
8