【Homebrew/M1/MaxOS】M1チップのMac に Homebrew をインストールする方法
今回は、Macユーザーには必須とも言える、Homebrewをインストールする方法を記していきます。
ツールをインストールする際、使用する機会が多いのでぜひ入れておきましょう。
2. Homebrewのコマンドの実行
ターミナルを開いて下記コマンドを実行します。
※Launchpad > その他 > ターミナル
¥ brew --version zsh: command not found: brew
インストールされていない場合は、上記の様なエラーが出ます。
3.Homebrewのインストール
インストール方法は、Homebrew の公式サイトにコマンドが記載されているので
そちらを使用します。
「Install Homebrew」の下にあるコマンドをコピーします。
ターミナルを開き、コピーしたコマンドを実行します。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ==> Checking for `sudo` access (which may request your password). Password: ==> This script will install:
実行するとパスワードを聞かれるので入力して、returnを押下します。
・・・ /opt/homebrew/Caskroom /opt/homebrew/Frameworks Press RETURN to continue or any other key to abort
インストールを続けるか、中止するか聞かれるので、
続ける場合は、「return」を押下
中止する場合は、「return」以外のキーを押下します。
インストールを続けると、最後の方にパスの設定がされていないとエラーが表示されます。
HEAD is now at a6959e4fc Merge pull request #12118 from Homebrew/dependabot/bundler/Library/Homebrew/sorbet-0.5.9155 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.
よく見ると次にやって欲しいことが記載されています。
==> Next steps: - Run these two commands in your terminal to add Homebrew to your PATH: <span style="color: #ff5252">echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/{ユーザー名}/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"</span>
記載されている通りに、コマンドを実行しましょう。
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/{ユーザー名}/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"
これでパスの設定は完了です!
3.Homebrewのバージョン確認
正常にインストールできているか、再度下記コマンドを実行して確認しましょう。
¥ brew --version Homebrew 3.2.13 Homebrew/homebrew-core (git revision d43f843b67; last commit 2021-09-24)
上記の通り、バージョンが表示されれば正常にインストール完了です。
インストールも簡単で、今後開発を行っていく上で必要となるので、ぜひインストールしておきましょう。