Homebrew
由于国外镜像不FQ的安装的话基本就会被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.ustc.edu.cn/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/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