使用
HomeBrew
官方的源下载很慢,等半天还经常中断。为提高下载安装速度,推荐设置为国内的镜像。
配置阿里云镜像
# 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 应用生效
brew update
# bash替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# zsh替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
常见问题
- 执行
source ~/.zshrc
的时候报compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_cask
解决方案:# 先清除 brew cleanup # 再执行source source ~/.zshrc
配置之后,速度就快很多倍了,效率杠杠~