Homebrew
由於國外鏡像不翻牆的安裝的話基本就會被qiang,所以按照官網的方式去安裝會有error: RPC failed
的錯誤;
可以將安裝的文件下載到本地,通過修改國內源去安裝;
下載源到本地
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
修改鏡像源
將
BREW_REPO = "https://github.com/Homebrew/brew".freeze
修改為(如果沒有找到的CORE_TAP_REPO的話直接復制)
BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git".freeze
通過腳本安裝brew
直接在控制台輸入
/usr/bin/ruby brew_install
這里用的是中科院的源,可能會出現
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
Failed during: /usr/local/bin/brew update --force
需要執行git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
homebrew-core的鏡像地址也設為中科院的國內鏡像
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