「パスが通っていないよ」と言われる
Homebrew公式サイトからインストールコマンドをコピーし、ターミナル上でペースト&実行してみたところ、以下のようなメッセージが。
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!
インストール自体は成功したようですが、「パスが通っていないよ」とWarningが出ています。
$ brew -v
zsh: command not found: brew
当然、brewコマンドは使えません。
解決方法
# .zshrcを開く(bashの場合は.bashrc)
$ vi ~/.zshrc
# 以下を追加して閉じる
export PATH=/opt/homebrew/bin:$PATH
# 設定を反映する
$ source ~/.zshrc
これでパスを通すことができました。
$ brew -v
Homebrew 4.3.18
無事、brewコマンドが使えるようになりました。