【M1 MacBook】Homebrewのインストール
M1 MacBookに導入した時の備忘録。
Homebrewとは
macOS、Linux、Windows Subsystem for Linuxで動作するパッケージ管理システム。 開発に必要なありとあらゆるツールをインストールして管理するためのもの。
<公式サイト>
ビールのアイコンが目印!
brew.sh
手順
①ビールのアイコンが目印の公式サイトから、以下をコピー。 ターミナルに貼り付け、エンター押下。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
②パスワードを入力
③しばらく待つと以下の文言が出てくる。
==> 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 "$(/usr/local/bin/brew shellenv)"') >> /Users/xxxxxx/.zprofile eval "$(/usr/local/bin/brew shellenv)" - Run brew help to get started - Further documentation: https://docs.brew.sh (base)xxxxxx@xxxxxxnoMBP ~ %
次のステップとして、以下のコマンドを叩いて、Homebrewにパスを通せと書いてあるので、言われた通り、echo 〜をコマンド実行。
※以下はNGコマンド
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/xxxx/.zprofile eval "$(/usr/local/bin/brew shellenv)"
実行結果
(base) xxxxx@xxxxxxMBP ~ % echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/xxxxx/.zprofile eval "$(/usr/local/bin/brew shellenv)" zsh: parse error near `)'
「parse error near」ということでエラーになってしまったのですが、 いかんいかん、「(」 が抜けていました。 指示通りのコマンドを注意深く叩きましょう。。。
正しいコマンド
echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/xxxx/.zprofile eval "$(/usr/local/bin/brew shellenv)"
これでzprofileが読み込まれるたびに、echo以下のコマンドが実行されるようになる。 パスが通ったら、Homebrewが正常にインストールされたかを以下のコマンドで確認。
brew -v
Homebrewのバージョンが表示されていればok。
Homebrew 4.0.10 Homebrew/homebrew-core (git revision 7374bcd423c; last commit 2023-01-20)
HomebrewのインストールはこれでOK! バージョン表示がされない場合は、コマンドの実行誤りがないか、もしくはターミナルを再起動して確認してみるとよい。 ターミナル再起動のほか、
open /Users/xxxx/.zprofile
source /Users/xxxx/.zprofile
で読み込みをし直すという方法もあるみたい。
ではでは、以上。