Before install Homebew, make sure your macOS meets the install requirements.
Install Homebrew on macOS 11 (Apple Silicon)
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
When downloaded, it will detect your macOS architecture and if it’s Intel, Homebrew will be installed on /usr/local
, or /opt/homebrew
if macOS is Apple Silicon. Our macOS 11 is Apple Silicon (M1), hence Homebrew will be located at /opt/homebrew
.
Install another copy of Homebrew for Intel simulated terminal
For macOS 11 ARM (Apple Silicon), it’s best practice to install a 2nd copy of Homebrew dedicated to running programs that are not yet natively compiled for ARM. The second Homebrew must be installed on /usr/local
as recommended from the Alternative Installs option - Untar anywhere, or things would break when install by brew install
.
$ cd /usr/local
$ mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
Using ARM Homebrew and Rosetta Homebrew together
Now when you type brew
on the terminal, the native ARM Homebrew is running
$ which brew
/opt/homebrew/bin/brew
$ brew --version
Homebrew 3.1.11
Homebrew/homebrew-core (git revision 7c34424687; last commit 2021-06-10)
Homebrew/homebrew-cask (git revision ab9a64f927; last commit 2021-06-10)
Edit your ~/.zshrc
and put this alias
alias ibrew='arch -x86_64 /usr/local/bin/brew'
Whenever you need to install a package under Rosetta, just use ibrew install ...