🍺

M2 MacにHomebrewをインストール

2022/10/11に公開

インストール方法はintelのMacと同じなのですが、Appleシリコンの場合はパスを自分で通すようです。

インストール

下記の公式サイトからコピーしてターミナルに貼り付けて実行してください。
https://brew.sh/

途中で下記のようにMacのパスワードとエンターキーの入力を求められるので入力します。
==> Checking for `sudo` access (which may request your password)...
Password:Macのパスワードを入力
Press RETURN/ENTER to continue or any other key to abort:Enterキーを押す

PATHを通す

Appleシリコンの場合下記のようなWarningが出ると思うので対処します。

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 three commands in your terminal to add Homebrew to your PATH:
    echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/wataree/.zprofile
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/wataree/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

Warning: /opt/homebrew/bin is not in your PATH.
パスが通っていない的なことを言われるので、==> Next steps:で書かれている内容を2つ実行します。

○○○○のところは自分のユーザーネームです。==> Next steps:で書かれている内容をコピーしてくれば間違いないです。

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/○○○○/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

その他のコマンド

# Homebrewバージョンの確認
brew -v
# Homebrewでインストールしたパッケージの確認
brew list

Discussion