Homebrew
brew update 太慢或失败:
| cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
brew update
|
替换 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 的默认镜像配置了,满足日常使用不成问题。
如果你想更进一步优化下载速度,还可以为 Homebrew Bottles 也配置上镜像。
有些同学可能不太清楚 Homebrew Bottles,这里先跟大家简单介绍下。
在我们使用 brew install 安装软件包的时候,通常有两种方式,一种是将代码下载到本地并完成构建,另一种则是直接下载安装包的二进制文件(Bottles)。
正常情况下,后者的速度都要优于前者,毕竟你不用再进行一次构建工作。
| echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
|
更新 homebrew
homebrew 检查
| $ brew doctor
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
python@3.8
python@3.9
|