MAC 替换及重置Homebrew默认源

homebrew主要分两部分:git repo(位于GitHub)和二进制bottles(位于bintray),这两者在国内访问都不太顺畅。可以替换成国内的镜像,git repo国内镜像就比较多了,可以自行查找,提供二进制镜像的源。

替换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 Bottles源: 参考:替换Homebrew Bottles源

在中科大源失效或宕机时可以:

  1. 使用清华源设置参考
  2. 切换回官方源:
重置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

PS:掉bash配置文件里的有关Homebrew Bottles即可恢复官方源。 重启bash或让bash重读配置文件。

非特殊说明,本博所有文章均为博主原创。

备注:相关侵权、举报、投诉及建议等,请联系站长

添加新评论

昵称
邮箱
网站