Switch terminal

The terminus of m1 is -zsh

There are some other issues with installing Homebrew, so replace it with bash here. Type bash directly on the terminal:

Download the official installation script file

Click here to go to the official website,

Open the install script file in your browser, just click raw.githubusercontent.com/Homebrew/in… Copy and paste it into a new file, put it in your personal folder,

Then start replacing the domestic mirror source.

Replace the domestic mirror source

Change the three items in the red box above to:

Hkust Mirror image:

https://mirrors.ustc.edu.cn/homebrew-core.git

https://mirrors.ustc.edu.cn/linuxbrew-core.git

https://mirrors.ustc.edu.cn/brew.git
Copy the code

Run the modified script file to install Homebrew

Run the script on the bash terminal

/bin/bash brew_install
Copy the code

Exit bash after installation:

exit
Copy the code

It added PASH

Open.zshrc at the terminal

vi ~/.zshrc
Copy the code

Add command:

path=('/opt/homebrew/bin' $path)
export PATH
Copy the code

Save the file, restart the terminal, and type brew:

At this point, Homebrew has finally been successfully installed.