Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)

MacosArmHomebrewMacos Big-SurApple Silicon

Macos Problem Overview


I use the latest Apple M1 chip processor. And I keep getting errors while application installation.

say.,

brew install openjdk@11
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

Need help with exact steps to follow.

Macos Solutions


Solution 1 - Macos

For what it's worth, before installing Homebrew you will need to install Rosetta2 emulator for the new ARM silicon (M1 chip). I just installed Rosetta2 via terminal using:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

This will install rosetta2 with no extra button clicks.

After installing Rosetta2 above you can then use the Homebrew cmd and install Homebrew for ARM M1 chip: arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Once Homebrew for M1 ARM is installed use this Homebrew command to install packages: arch -x86_64 brew install <package>

Solution 2 - Macos

Homebrew needs to be installed in two places on Apple silicon: in /usr/local for rosetta-emulated (Intel) code, and /opt/homebrew for ARM64. These are somewhat hard-coded and the /opt/homebrew one MUST be used for ARM code, as it stands today, and is non-negotiable. However, it's easy enough to install and you can follow the general instructions on the official docs. You open a Rosetta shell first.

% arch -x86_64 zsh
% cd /usr/local && mkdir homebrew
% curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

Later, to install tools under intel you can use the arch command per-command or open a zsh terminal as above.

arch -x86_64 /usr/local/homebrew/bin/brew install sometool

For the ARM architecture, you don't need to use arch but you do need to use the full path of the homebrew command.

/opt/homebrew/bin/brew install sometool

You could rename the brew commands to something like brew86 and brewARM to help keep them separate.

Solution 3 - Macos

Just use:

arch -arm64 brew install package-name

replace 'package-name' with the package you want to install.

Solution 4 - Macos

Did a temporary fix by enabling Open using Rosetta option in the terminal app from Utilities folder.

However, it would be great to know the actual solution for this question to use the native way.

enter image description here

Solution 5 - Macos

This issue with new macbook pro M1 chip

Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!

For Resolve follow below steps

> Step1 > > $ brew bundle dump > > Step2 > > $ /bin/bash -c "$(curl -fsSL > https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; > > Step3 > Edit file below

> $ vi ~/.bashrc or vi ~/.zshrc > > Edit below line in above file

> export PATH=/opt/homebrew/bin:$PATH

Solution 6 - Macos

Run this in the terminal it fixes the issue

eval "$(/opt/homebrew/bin/brew shellenv)"

Solution 7 - Macos

First run this command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

then it will ask you a question, hit return, then wait for the installation to be completed. After than run this command:

brew bundle dump

Solution 8 - Macos

This also may occur if you are trying to run your command in IntelliJ Terminal. Just try to run in (Regular) Terminal.

Solution 9 - Macos

Homebrew is now available for the new apple M1 chip at https://docs.brew.sh/Installation. The script installs in a new location, ‘/opt/homebrew’ instead of ‘/usr/local’ which requires that you implement a couple lines of script after the install, substituting your username. You can copy/paste from the comments in your install. Just don’t skip these steps.

==> Next steps:
- Add Homebrew to your PATH in /Users/[username]/.zprofile:
    echo 'eval "$(/opt/homebrew/bin/brew [username])"' >> /Users/[username]/.zprofile
    eval "$(/opt/homebrew/bin/brew [username])"

Note: This works for a clean install of Homebrew on a new machine. If you have already installed an old version of Homebrew and got it working, I believe you need to uninstall that first -or- you may find this a quicker work-around http://blog.wafrat.com/homebrew-on-mac-with-m1/. Not tested.

Solution 10 - Macos

So I bought a new M1 and migrated to it. I took it back and migrated back. I was receiving this error. Found that I needed to run sudo rm -Rf /opt/homebrew after re-installing brew to get things flowing again. 16G Ram on the M1 didn't replace my workflow with Intel using 64G.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPrashanth SamsView Question on Stackoverflow
Solution 1 - MacosemonzView Answer on Stackoverflow
Solution 2 - Macoscourt3nayView Answer on Stackoverflow
Solution 3 - MacosJeff HoggView Answer on Stackoverflow
Solution 4 - MacosPrashanth SamsView Answer on Stackoverflow
Solution 5 - Macosmanoj patelView Answer on Stackoverflow
Solution 6 - Macosgandharv gargView Answer on Stackoverflow
Solution 7 - MacosAmir Hassan AzimiView Answer on Stackoverflow
Solution 8 - MacoscmlonderView Answer on Stackoverflow
Solution 9 - MacosAlison KrauskopfView Answer on Stackoverflow
Solution 10 - MacosJJ SmithView Answer on Stackoverflow