Homebrew installation strategy of M1 MAC based on ARM architecture

M1 Mac installs Homebrew
Mainly refer to the use of installation process

Main reference


Main strategy: Install ARM version and X86 version of Homebrew respectively, and in.zshrc through alias name, respectively, to achieve coexistence and specify calls.
The installation process
First install M1 version of BREW, there is no official installation script.

Can focus on website https://brew.sh/
and M1 version homebrew problem summary posted at https://github.com/Homebrew/brew/issues/7857

cd /opt # Switch to the /opt directory
mkdir homebrew # Create the homebrew directory
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

Then write the environment variable of ZSH (assuming ZSH is used)

vim ~/.zshrc

#Write at the beginning
export PATH="/opt/homebrew/bin:$PATH"

Vim basic operation:


Install an x86 version of HomeBrew for later use

#Open a new page of zsh
arch -x86_64 $SHELL

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

Write environment variables

vim ~/.zshrc

#Write after
export PATH="/usr/local/bin:$PATH"

Let the two coexist with Alias

vim ~/.zshrc

#Write after
alias abrew='/opt/homebrew/bin/brew' # ARM Homebrew
alias ibrew='arch -x86_64 /usr/local/bin/brew' # X86 Homebrew

In ZSH, input such as “Abrew List” to call ARM BREW under OPT and input “iBREW List” to call X86 BREW under USR /local. The PATH of ARM BREW is in front, so the input of “BREW List” calls ARM BREW by default. When there is a package with the same name in the two BREWS, the default priority is to call ARM BREW under the bin.

Read More: