Error: Cannot install in Homebrew on ARM processor in Intel default prefix
<The problem>
when you are using M1 processor Mac PC and execute
brew install xxx
If you are reading this article, you are probably someone who has run the brew command and received the following error.
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
I share a solution to this error!
(The error is caused by M1 Mac.)
<The solution>
cd /opt
sudo mkdir homebrew
sudo chown $(whoami):admin homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
After this step, the brew command will be installed in /opt/homebrew/bin
Then, to pass PATH, add to ~/.zshrc this:
export PATH="/opt/homebrew/bin:$PATH"
You can now use homebrew in /opt/homebrew/bin by reloading the terminal with or
source ~/.zshrc
and this time the error and you can use
brew install xxx
I hope that this article will be of some help to you!
Happy Developing!