先用了下直接安装的命令
ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
非常非常慢
去网上搜了下加速方法,基本原理就是把install文件自己下下来,把里面下载镜像改了
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh >> brew_install
# 找到 BREW_REPO="https://github.com/Homebrew/brew" 替换为 BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"
sh brew_install
报错
Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core’…
fatal: unable to access ‘https://github.com/Homebrew/homebrew-core/’: Empty reply from server
Error: Failure while executing; git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
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
不用管,接着往后运行
mkdir -p /usr/local/Homebrew/Library/Taps/homebrew
cd /usr/local/Homebrew/Library/Taps/homebrew
git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 把homebrew repo切换为清华镜像
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update