建议更换为华科大的镜像源

#更新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

最后设置你命令行的环境变量HOMEBREW_BOTTLE_DOMAIN(很重要)

  • zsh用户
    在~/.zshrc加入如下语句(该文件若有设过HOMEBREW_BOTTLE_DOMAIN,删掉即可)
    export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/
    source ~/.zshrc #(使刚更改生效)
  • bash
    打开~/.bash_profile加入如下语句(该文件若有设过HOMEBREW_BOTTLE_DOMAIN,删掉即可)
    export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/
    source ~/.bash_profile #(使刚更改生效)

最后试下更新brew
brew update --verbose#verbose能看到更具体的更新过程

标签: none

添加新评论