Loading... <div class="tip share">请注意,本文编写于 1228 天前,最后修改于 632 天前,其中某些信息可能已经过时。</div> brew如果不换成国内源,安装软件时候可能会出问题,不是安装不了就是速度很慢,所以使用它,更换国内游是比较好的选择! 由于与清华是隔壁,相较于中科大源,我更倾向于使用清华源 ## 替换Homebrew的formula索引的镜像 ### 替换现有上游 在终端中输入 ```bash cd "$(brew --repo)" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git brew update ``` ### 使用homebrew-science或者homebrew-python 在终端中输入 ```bash cd "$(brew --repo)/Library/Taps/homebrew/homebrew-science" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-science.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-python" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-python.git brew update ``` ## 替换Homebrew二进制预编译包的镜像 在终端中输入 ```bash #临时替换 export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles #长期替换 echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile ``` ## 重置Homebrew默认源 在清华源失效或宕机时可以 1. 使用中科大源[https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git](https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git) 2. 切换回默认源,在终端中输入 ```bash cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core.git ``` 3. 注释掉bash配置文件里的有关Homebrew Bottles即可恢复官方源。 重启bash或让bash重读配置文件。 最后修改:2020 年 10 月 11 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 0 如果觉得我的文章对你有用,请随意赞赏