让 HomeBrew 加速起飞

前言,在我国作程序员有天生的劣势,主要分为语言网络环境git

点到即止,brew update 真心慢的一批程序员

今天鄙人有幸分享一下如何让电脑上的 homebrew 加速起飞github

1. 修改源镜像

鄙人用的是清华大学镜像站shell

1.1 替换

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

brew update
复制代码

1.2 还原(若是仍是喜欢 github 更新的话)

git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git

brew update
复制代码

2. 修改bottles

打开你正在使用的shell配置文件,例如:.zshrc网络

在文件中合适位置(你看哪里顺眼加哪里,无所谓)加入如下变量url

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
复制代码

3. 完工

再试试 brew update, 是否是单车变摩托spa

相关文章
相关标签/搜索