HomeBrew 安装软件慢的解决方法

发布时间:2023-04-18 00:04:35,浏览1733次

用原有的镜像下载非常慢犹如蜗牛爬山
替换源,更新速度变成火箭速度

第一步:更换仓库源

homebrew默认的源是在github上面,每次更新速度都会非常慢。所以我们更换成国内的镜像源。就会快很多了。

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

# 可能这个仓没有则不需要执行
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

brew update

第二步:更换Homebrew-bottles镜像(影响软件下载速度)

临时替换

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源

评论