LoginSignup
2
3

More than 1 year has passed since last update.

M1 Macでhomebrewはあるのにエラーが出るとき

Posted at

ARM版のMacを使っていると、ターミナルのコマンドやらでいろいろ頼んでもないエラーがでるときがあります。

そのなかでもhomebrewらへんは厄介かなと。

基本的には
https://docs.brew.sh/Installation
のとおりにすれば解決できます。
しかし、インストールした後にも、(brew -vでもちゃんと確認できるにもかかわらず)

Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
  https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
  brew bundle dump

のようなエラーがでてしまうことがありました。

解決策

結論から言えば、

パスの優先度が低いまま

が原因だそうです。

なんやかんやいろんなPATHを通して訳がわからなくなるうちに、
usr/local/homebrewが今回インストールした/opt/homebrewよりも先に来てしまうことが原因です。

この順番をちゃちゃっと入れ替えれば基本的には直ります。
書き換える方法は``source ~/.zshrc```とかで直接編集するなどお好きなように〜
(あくまで私の場合となるため、さまざまなケースには対応していないです)

その後に
brew cleanupでもしておけば、さまざまな依存関係を解消してくれます

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3