brew
默认的源是Github
,会很是慢,建议换为国内的源。推荐中科大的镜像源
,比较全面.git
Homebrew
源代码仓库github
替换源地址:
cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
bash
重置为官方地址:
cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git
url
Homebrew
预编译二进制软件包code
在运行brew
, 前设置环境变量HOMEBREW_BOTTLE_DOMAIN
,值为https://mirrors.ustc.edu.cn/homebrew-bottles
homebrew
bash:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile
rem
zsh:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc source ~/.zshrc
it
Homebrew
核心软件仓库zsh
替换源地址:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
编译
重置为官方地址:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core
Homebrew cask
软件仓库,提供macOS
应用和大型二进制文件
替换源地址:
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
重置为官方地址:
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask git remote set-url origin https://github.com/Homebrew/homebrew-cask