Homebrew 是一个免费的开源软件包管理系统,可简化在 MacOS 上安装软件的流程。
官网:https://brew.sh/ (英文) 官网:https://brew.sh/index_zh-cn (中文)
根据我实际体验,这种方法只能说勉强,效果并不好,所以还是 科 学 上 网
吧!😂
设置镜像
# 替换 brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 替换 homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 替换 homebrew-cask.git
cd "$(brew --repo homebrew/cask)"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# 对于 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
取消设置
# 重置 brew.git
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
# 重置 homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
# 重置 homebrew-cask.git
cd "$(brew --repo homebrew/cask)"
git remote set-url origin https://github.com/Homebrew/homebrew-cask
~/.zshrc
或者 ~/.bash_profile
删除或者注释掉
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles