LoginSignup
1
1

More than 1 year has passed since last update.

M1 macでHeroku CLIをインストールする方法

Last updated at Posted at 2021-06-05

問題

M1 macでHeroku CLIをインストールしようとすると

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

とエラーが出る。
おそらくhomebrewを、localディレクトリではなくてoptディレクトリにインストールするように言われている。

解決

まずはoptディレクトリの中を確認してみる。

$ ls /opt
homebrew

どうやら、optディレクトリにはhomebrewはインストールされていたので、パスが通っていないことが原因だと考えられる。
パスを通すために、~/.zshrcファイルに以下のコードを追加する。

~/.zshrc
export PATH=/opt/homebrew/bin:/usr/local/bin:$PATH

最後に

$ brew tap heroku/brew && brew install heroku

を入力してインストールできました!

参考記事

もし、optディレクトリにhomebrewがインストールされていなかった場合は下記を参考にしてみてください!
https://www.teamxeppet.com/macbook-m1-homebrew-install/

最後に

初心者ながら、自分がわかる範囲で記事を書かせていただきました。
間違っているところがあれば、ご指摘いただきたいです。
皆さんの参考になれば、嬉しいです。

1
1
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
1
1