【初心者向け】macOS での Homebrew 基本操作を徹底解説

この記事のポイント
-
Homebrew(ホームブリュー)とは?
macOS でアプリやツールを簡単にインストール・管理できるパッ ケージマネージャー。
brew install コマンド一つで、ダウンロードから設定まで自動で完了します。 -
基本操作を覚えればアプリ管理が劇的に効率化
brew install、brew uninstall、brew upgradeなどの基本コマンドで、
ソフトウェアの導入・アップデート・削除をすべてターミナル上で完結できます。 -
初心者でも安心の手順つき解説
インストール・アンインストール手順、よく使うコマンド、トラブル診断(brew doctor)までを具体的に紹介しています。
Homebrew とは?macOS における役割を理解しよう
Homebrew(ホームブリュー)は、主に macOS で ソフトウェアを簡単にインストール・管理できる「パッケージマネージャー」 です。
Windowsでいう winget 、Linux でいう apt や yum に相当します。
たとえば、ブラウザの Google Chrome や開発ツールの Git、Node.js などをインストールする際、
公式サイトからダウンロード → 解凍 → アプリケーションディレクトリにコピー
といった手順を毎回行うのは面倒ですよね。
Homebrew を使えば、ターミナルで以下のように1行コマンドを入力するだけです。
brew install gitこれだけで、自動的にダウンロード・展開・配置まで完了します。 しかも、依存関係(必要なライブラリなど)も自 動で解決してくれます。
本記事を読む上での前提知識
Homebrew はターミナルからコマンドを実行して利用します。 ターミナル操作が不安な方は、以下のページをあらかじめ参照しておいてください。

Homebrew インストール方法
本章では、Homebrew のインストール手順について解説します。
- macOS 13
動作確認環境
- Apple M2 / macOS 13.0 Ventura
- zsh
- Homebrew 3.6.20
手順
まずは「ターミナル」を起動します。
ターミナルが起動したら以下のコマンドを実行します。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"インストールは管理者権限で実行する必要があるため(現在ログインしているユーザーの)パスワードを入力しreturnキーを押します。
==> Checking for `sudo` access (which may request your password)...
Password:インストールしてよいか確認されます。問題なければ、returnキーを押します。
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks
Press RETURN/ENTER to continue or any other key to abort:
しばらくすると、以下の通り Installation successful! と表示され、インストールが完了します。
11行目の Next steps: に続けて実行すべきコマンド内容が記載されています。
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run these three commands in your terminal to add Homebrew to your PATH:
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/username/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/username/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
13~15行目に記載されているとおり、以下の echo コマンドと eval コマンドを実行します。
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/username/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/username/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"上記のコマンドを実行することで、brewコマンドにPATHを通すことができます。
PATHについて詳しく知りたい方は、以下のページを参照してください。

brewコマンドにPATHが通っていることを確認します。
which brew以下の通り表示されていれば設定完了です。
/opt/homebrew/bin/brew以上が、Homebrew のインストール手順です。
Homebrew アンインストール方法
本章では、Homebrew のアンインストール手順について解説します。
- macOS 13
動作確認環境
- Apple M2 / macOS 13.0 Ventura
- zsh
- Homebrew 3.6.20
手順
まずは「ターミナル」を起動します。
ターミナルが起動したら、以下のコマンドを実行します。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"アンインストールしてよいかどうかの確認が表示されます。問題ないので y を入力しreturnキーを押します。
Warning: This script will remove:
/Users/username/Library/Caches/Homebrew/
/Users/username/Library/Logs/Homebrew/
/opt/homebrew/.devcontainer/
/opt/homebrew/.dockerignore
/opt/homebrew/.editorconfig
/opt/homebrew/.git/
/opt/homebrew/.github/
/opt/homebrew/.gitignore
/opt/homebrew/.shellcheckrc
/opt/homebrew/.sublime/
/opt/homebrew/.vale.ini
/opt/homebrew/.vscode/
/opt/homebrew/CHANGELOG.md
/opt/homebrew/CONTRIBUTING.md
/opt/homebrew/Caskroom/
/opt/homebrew/Cellar/
/opt/homebrew/Dockerfile
/opt/homebrew/LICENSE.txt
/opt/homebrew/Library//
/opt/homebrew/README.md
/opt/homebrew/bin/brew
/opt/homebrew/completions/
/opt/homebrew/docs/
/opt/homebrew/manpages/
/opt/homebrew/package/
Are you sure you want to uninstall Homebrew? This will remove your installed packages! [y/N]
パスワードの入力を求められますので、(現在ログインしているユーザーの)パスワードを入力しreturnキーを押します。
==> Removing Homebrew installation...
==> Removing empty directories...
Password:
しばらくすると、以下の通り Homebrew uninstalled! と表示され、アンインストールが完了します。
==> /usr/bin/sudo /usr/bin/find /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/opt /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/Frameworks -name .DS_Store -delete
==> /usr/bin/sudo /usr/bin/find /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/opt /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/Frameworks -depth -type d -empty -exec rmdir {} ;
==> Homebrew uninstalled!
The following possible Homebrew files were not deleted:
/opt/homebrew/Frameworks/
/opt/homebrew/bin/
/opt/homebrew/etc/
/opt/homebrew/include/
/opt/homebrew/lib/
/opt/homebrew/opt/
/opt/homebrew/sbin/
/opt/homebrew/share/
/opt/homebrew/var/
You may wish to remove them yourself.
最後に(インストール時に追記した) /Users/username/.zprofile から、次の2行を削除します。
# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/opt/homebrew/bin/brew shellenv)"以上が、Homebrew のアンインストール手順です。
Homebrew コマンドの使い方
Homebrew を実際に使ってみましょう。ここでは代表的なコマンドを具体例付きで解説します。
| コマンド | 概要説明 |
|---|---|
brew install |
パッケージをインストール |
brew upgrade |
パッケージをアップデート |
brew uninstall |
パッケージをアンインストール |
brew search |
パッケージを検索 |
brew list |
インストール済みのパッケージ一覧を確認 |
brew cleanup |
キャッシュや不要ファイルを削除 |
brew doctor |
トラブルの診断 |
- インストール
- アップデート
- アンインストール
- パッケージ検索
- 一覧表示
- キャッシュ削除
- トラブル診断
brew installコマンドは、指定したパッケージをインストールするコマンドです。
brew install パッケージ名例えば「Google Chrome」をインストールする場合は以下の通り実行します。
brew install google-chrome実行結果例はこちら
==> Downloading https://dl.google.com/chrome/macos/universal/stable/GGRO/googlechrome.dmg
Already downloaded: /Users/username/Library/Caches/Homebrew/downloads/88881e66883c4776fff9b3019b48a26795020439a33ddbedd3bd4620283aecd2--googlechrome.dmg
Warning: No checksum defined for cask 'google-chrome', skipping verification.
==> Installing Cask google-chrome
==> Moving App 'Google Chrome.app' to '/Applications/Google Chrome.app'
🍺 google-chrome was successfully installed!
まとめ
Homebrew は、macOS でアプリや開発ツールを効率的に管理できる非常に便利なパッケージマネージャーです。
コマンド一つでインストール・アップデート・削除が行えるため、手動でダウンロードする手間を大幅に減らせます。
本記事では、Homebrew のインストール・アンインストール手順、代表的なコマンドの使い方を初心者向けに解説しました。
初めてターミナルを使う方でも、brew install さえ覚えれば環境構築がぐっと楽になります。
ぜひこの記事を参考に、Mac環境を効率的にカスタマイズ・管理してみてください。
参考情報


コメント