brew 更换下载镜像以提升下载速度
1️⃣ 更换下载源为 中国科学技术大学镜像站
# 新建 homebrew-cask 文件夹,若已经存在则无需新建 | |
mkdir "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" | |
# 将三个目录作为安全目录目录添加到全局的 Git 配置中 | |
git config --global --add safe.directory "$(brew --repo)" | |
git config --global --add safe.directory "$(brew --repo)/Library/Taps/homebrew/homebrew-core" | |
git config --global --add safe.directory "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" | |
# 更新 Homebrew | |
cd "$(brew --repo)" | |
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git | |
# 更新 Homebrew-core | |
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" | |
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git | |
# 更新 Homebrew-cask | |
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" | |
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git |
2️⃣ 选择 zsh 或 bash 用户,执行即可
- bash 用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/' >> ~/.bash_profile
source ~/.bash_profile
- zsh 用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/' >> ~/.zshrc
source ~/.zshrc
3️⃣ 更新 brew
brew update -v |
配置完成