homebrew 安裝踩坑解決過程


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM