Mac换国内镜像源快速安装homebrew,使用brew

/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的错误。

按照下边操作流程快速完美安装:
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 镜像使用帮助

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值