I am setting my MacOS fresh again and setting up my terminal. I wanted to use neofetch to get a nice-looking terminal prompt.
But upon running
brew install neofetch, I got 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
Apparently, this happens because I am using a Mac M1 with an ARM processor. As explained on stackoverflow
Homebrew needs to be installed in two places on Apple silicon:
/usr/localfor rosetta-emulated (Intel) code,
/opt/homebrewfor ARM64 (M1).
These are somewhat hard-coded and the
/opt/homebrewone MUST be used for ARM code and is non-negotiable
Following those steps below fixes the error for me.
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
arch -x86_64 brew install <package>
I ran the following for my use case above for
arch -x86_64 brew install neofetch
I can then install
neofetch as expected.
In the comment,
rahul suggested that you should add an alias to your
.zshrc file for future convenience.
alias alias brew86="arch -x86_64 /usr/local/homebrew/bin/brew"
Therefore the above install command will become
- arch -x86_64 brew install neofetch + brew86 install neofetch
zsh runs the binary in
/usr/local/bin by default. Running
brew86 will probably change the location newly installed application to
You must also add the following to
.zshrc so that
zsh recognizes the binary in the new location.
Otherwise, you’ll see some errors like this:
zsh: command not found: pyenv