Overview
Homebrew は Mac/Linux で使用できるパッケージマネージャーです。Homebrew を使用すると、brew コマンドを使用して必要なソフトウェアをインストールすることができます。CentOS の DNF や Ubuntu の APT のようですが、DNF や APT はシステム全体に適用されるものに対し、Homebrew はアプリケーションだけに適用されます。つまり Mac の OS に影響を与えることがありません。Windows の winget や Ubuntu の SNAP に似た性質を持っています。
Homebrew のインストール
公式サイトに記載されている通りにコマンドを実行するだけでインストールできます。最後にパスを通すためのコマンドを実行して完了です。
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
==> 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:
==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /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
==> /usr/bin/sudo /bin/chmod ug=rwx /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
==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown myadmin /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
==> /usr/bin/sudo /usr/bin/chgrp admin /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
==> /usr/bin/sudo /usr/sbin/chown -R myadmin:admin /opt/homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 243115, done.
remote: Counting objects: 100% (753/753), done.
remote: Compressing objects: 100% (442/442), done.
remote: Total 243115 (delta 301), reused 698 (delta 268), pack-reused 242362
Receiving objects: 100% (243115/243115), 71.24 MiB | 12.19 MiB/s, done.
Resolving deltas: 100% (177837/177837), done.
From https://github.com/Homebrew/brew
* [new branch] dependabot/bundler/Library/Homebrew/json_schemer-0.2.25 -> origin/dependabot/bundler/Library/Homebrew/json_schemer-0.2.25
* [new branch] dependabot/bundler/Library/Homebrew/parser-3.2.2.3 -> origin/dependabot/bundler/Library/Homebrew/parser-3.2.2.3
* [new branch] master -> origin/master
* [new tag] 0.1 -> 0.1
* [new tag] 0.2 -> 0.2
* [new tag] 0.3 -> 0.3
* [new tag] 0.4 -> 0.4
* [new tag] 0.5 -> 0.5
// omit
* [new tag] 4.0.5 -> 4.0.5
* [new tag] 4.0.6 -> 4.0.6
* [new tag] 4.0.7 -> 4.0.7
* [new tag] 4.0.8 -> 4.0.8
* [new tag] 4.0.9 -> 4.0.9
HEAD is now at 5bf89a3d2 Merge pull request #15585 from reitermarkus/cloudflare-header-check
Updated 2 taps (homebrew/core and homebrew/cask).
Warning: /opt/homebrew/bin is not in your PATH.
Instructions on how to configure your shell for Homebrew
can be found in the 'Next steps' section below.
==> 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 two commands in your terminal to add Homebrew to your PATH:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/myadmin/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
% (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/myadmin/.zprofile
% eval "$(/opt/homebrew/bin/brew shellenv)"
Homebrew のアンインストール
Homebrew は /opt にインストールされるので、それを削除するだけです。
% rm -fr /opt/homebrew
Mac Ventura Homebrew