Mac上使用brew update會卡住的問題
brew
默認的源是Github
,會非常慢,建議換為國內的源。推薦中科大的鏡像源
,比較全面.
解決方案
Homebrew
Homebrew
源代碼倉庫
-
替換源地址:
cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
-
重置為官方地址:
cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git
Homebrew Bottles
Homebrew
預編譯二進制軟件包
在運行brew
, 前設置環境變量HOMEBREW_BOTTLE_DOMAIN
,值為https://mirrors.ustc.edu.cn/homebrew-bottles
- 替換源地址:
-
bash:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile
-
zsh:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc source ~/.zshrc
-
Homebrew Core
Homebrew
核心軟件倉庫
-
替換源地址:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
-
重置為官方地址:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core
Homebrew Cask
Homebrew cask
軟件倉庫,提供macOS
應用和大型二進制文件
-
替換源地址:
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-cask git remote set-url origin https://github.com/Homebrew/homebrew-cask