How to install homebrew on MAC M1


Most commonly used commands

Search software: brew search package name

Installation software: brew install package name

Uninstall software: brew install package name

Error resolution

Question 1: curl: (7) failed to connect to port 443: Connection refused “error


Open Website The real IP address of the host

Open the / etc / hosts file and add a record 

Question 2:If the following error occurs in brew install, use arch – arm64 brew install package name for installation

Create installation directory

The homebrew installation script will install the program to / usr / local / homebrew by default, which is the installation path on Intel chip architecture, while the M1 chip needs to be installed under / opt / homebrew /.

sudo mkdir -p /opt/homebrew
sudo chown -R $(whoami) /opt/homebrew

Download the homebrew package and unzip it to the / opt / homebrew directory

curl -L | tar xz --strip 1 -C homebrew

If the download is slow, you can download it directly through Or download it locally, copy it to / opt directory, and then extract the compressed package to / opt / Hometree directory

cp /opt
Tar XZ package name -- strip 1 - C homebrew

Add the path to the path environment variable

vim ~/.bash_profile
#In. Bash_ New in profile
export PATH=$PATH:/opt/homebrew/bin;
#Save exit
#Refresh to take effect
source ~/.bash_profile

Modify source

cd "$(brew --repo)"
git clone
cd "$(brew --repo)/Library/Taps/homebrew"
git clone
git clone
Brew update

Other image addresses:

Official image of homebrew:

Tsinghua University Image:

Image of China University of science and technology

Finally, we can download the software

Brew install - s package name

So far, this article about how to install homebrew for Mac M1 is introduced. For more information about installing homebrew for M1, please search previous articles of developer or continue to browse the following articles. I hope you can support developer more in the future!