讓 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

相關文章
相關標籤/搜索