M1 MacにHomebrewをインストールする方法

インストール

ターミナルで下記コマンドを実行。


/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

PATHを通す

インストールコマンドを実行すると、「下記2つのコマンドを実行してPATHに追加しろ」と言われますので、

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ユーザー名/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

言う通りに実行します。


echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ユーザー名/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

確認

brew -vコマンドでバージョンが出力されたら完了です。

brew -v
Homebrew 3.3.9
Homebrew/homebrew-core (git revision af6858c52af; last commit 2022-01-04)

参考