一,把官網給的腳本拿下來
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
二,更改腳本中的資源鏈接,替換成清華大學的鏡像
就是把句
BREW_REPO = "https://github.com/Homebrew/brew".freeze
更改為這兩句
BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git ".freeze
這個鏡像有問題的話,也可以換成別的
三,更換國內鏡像源:
執行下面這句命令,更換為中科院的鏡像:
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
就下載成功了
四,執行腳本
/usr/bin/ruby brew_install
五,開始使用brew命令