I recently tried to install QEMU on my M1 Mac but received the “Cannot install in Homebrew on ARM processor in Intel default prefix” error.
Here’s how I fixed the issue.
The Error
Here’s the code I ran that resulted in the error:
brew install qemu
At first, it started updating Homebrew, and I thought everything was fine.
But then I got the 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
The Cause
I could tell by reading that error that it was probably related to the fact that I’m now running an M1 Mac instead of my old Intel based Mac.
According to the Homebrew documentation, the default Homebrew installation script installs Homebrew to its preferred prefix, which is /usr/local
for macOS Intel and /opt/homebrew
for Apple Silicon (and /home/linuxbrew/.linuxbrew
for Linux).
In my case, I had previously restored a Time Machine backup from my Intel Mac to my M1 Mac.
So in my case, I had an Intel installation of Homebrew running on my M1 Mac.
The Solution
Fortunately, the solution was easy. I simply ran the installation code that’s listed on the Homebrew homepage (under the Install Homebrew heading).
Therefore, I ran the following:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
That produced the following:
==> This script will install: /opt/homebrew/bin/brew /opt/homebrew/share/doc/homebrew /opt/homebrew/share/man/man1/brew.1 /opt/homebrew/share/zsh/site-functions/_brew /opt/homebrew/etc/bash_completion.d/brew /opt/homebrew ==> The following new directories will be created: /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks ==> The Xcode Command Line Tools will be installed. Press RETURN to continue or any other key to abort
So I went ahead and continued with the installation.
In a nutshell, it installed Homebrew into the /opt/homebrew/
directory, for the benefit of my M1 Mac.
Once I’d run that, I took the advice of the error message and ran the following to migrate my previously installed formula list:
brew bundle dump
Done.
One thing I noticed is that the error message suggests using one of the “Alternative Installs”, but it appears that the default installation script now caters for M1 Macs without the need for performing an alternative install.
If you’ve been stuck at the “Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!” error, I hope this helps!