HomeBrew设置阿里云镜像


使用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

配置之后,速度就快很多倍了,效率杠杠~


文章作者: zzq0324
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 zzq0324 !
  目录