借鉴:https://brew.idayer.com/guide/m1/

安装 ARM 版 Homebrew

/bin/bash -c "$(curl -fsSL <https://gitee.com/ineo6/homebrew-install/raw/master/install.sh>)"

设置镜像

# brew
git -C "$(brew --repo)" remote set-url origin <https://mirrors.ustc.edu.cn/brew.git>

# core
git -C "$(brew --repo homebrew/core)" remote set-url origin <https://mirrors.ustc.edu.cn/homebrew-core.git>

# cask
git -C "$(brew --repo homebrew/cask)" remote set-url origin <https://mirrors.ustc.edu.cn/homebrew-cask.git>

# bottles for zsh 和下面2选1
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
source ~/.zprofile

# bottles for bash 和上面2选1
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.bash_profile
source ~/.bash_profile