今天发现在用 brew 安装一个软件的时候非常非常慢,半天没反应,怀疑因为软件源在外国受墙的影响。
于是看了一下当前使用的是哪个源:
# 进入 brew 的仓库根目录
TMBP:~ tony$ cd "$(brew --repo)"
# 查看仓库地址
TMBP:Homebrew tony$ git remote -v
origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git (fetch)
origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git (push)
可以看到,其实 brew 的仓库本质上就是一个 git 仓库。
原来不是墙的干扰(一般情况下 GitHub 不会被墙,顶多也就慢一点)。
这就有点尴尬了,清华坑人啦~
看起来不错~
改成中科大的源:
# 进入 brew 的仓库根目录
cd "$(brew --repo)"
# 修改为中科大的源
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
同理,修改 homebrew-cask、homebrew-core、homebrew-services 的远程仓库地址
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
修改完仓库地址后,更新一下,加上 -v 参数可以看到当前跑的进度:
brew update -v
改完之后,果然快的一米!