在国内,使用brew极慢. 因为它需要访问国外的一些服务器.

解决方法是使用国内的镜像站.

如果是首次安装:

curl https://raw.githubusercontent.com/Homebrew/install/master/install.sh  > install-brew.sh

然后,在下载的文件中, 修改BREW_REPO为:

BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"

最后, 运行:

HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git bash install-brew.sh

如果是已经安装了brew, 可以这样替换镜像站:

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

替换后, 就可以正常使用brew了.

参考这篇文章 ==》 Mac解决brew慢的问题,添加国内源 

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐