【M2 Mac】Homebrewをzshで設定するまで
https://4.bp.blogspot.com/-8o9kLfgWwPY/VaYrVGzE__I/AAAAAAAAvow/kRjjmHL7cx8/s800/space_uchuhikoushi_kuma.png
【前提】
Macを新調してM2になったので、備忘録程度にHomebrewをzshで設定するまでの流れを記載しておきます。
【結論】
code:test.sh
(途中略)
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/tascript/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
next stepsで指定された2つのコマンドを実行するとbrewコマンドのパスが設定されます。
ちなみに、$ eval "$(/opt/homebrew/bin/brew shellenv)"ではこちらのシェルスクリプトが実行され、 シェル環境ごとのbrewコマンドに関する環境変数の設定が実施されます。これを.zshprofileに記載することで、シェル起動の際に環境変数設定がされるというわけです。便利。
念のため、brewコマンドのインストール先を確認します。
code:test.sh
$ which brew
/opt/homebrew/bin/brew
問題なさそうですね。
【余談】
こちらの記事でも記載しましたが、下記のコマンドで現在利用中のシェルの確認ができますので、参考までに。 code:test.sh
$ ps aux | grep $$ | grep -v grep
tascript 643 0.5 0.0 408677088 4800 s000 S 3:48AM 0:00.15 /bin/zsh -l