/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
由于GFW的存在,按照官方的方式去安装会碰到Failed to connect to raw.githubusercontent.com port 443: Connection refused的错误,或者安装过程中会碰到error: RPC failed的错误。
-
之前写的博客只解决了443,但是下载速度很慢,10kb左右,有vpn的伙伴可以尝试使用,减少多余操作,没有的伙伴请继续下边操作。
-
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused解决
按照下边操作流程快速完美安装:
1.执行命令下载brew_install
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh >> brew_install
2.本地执行之前需要将BREW_REPO = "https://github.com/Homebrew/brew"替换成以下内容
BREW_REPO="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
3.通过以下命令执行本地脚本
bash brew_install
4.碰到Error: Failure while executing; git clone的错误,执行以下脚本解决
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
5.安装完成后,还要通过以下命令将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
6.检查更新一下brew
brew update
7.设置二进制包镜像
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
大功告成:
还有其他疑问的伙伴可以在下方留言或查看清华大学开源软件镜像站Homebrew/Linuxbrew 镜像使用帮助