Mac安装homebrew报错curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation

本文介绍了解决Homebrew安装过程中遇到的网络问题的方法,通过下载并本地运行安装脚本来规避网络不稳定的影响。此外,详细阐述了如何更换Homebrew的源,包括中科大和清华两个常用镜像源的配置步骤,确保后续的软件包更新和安装更加顺畅。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

homebrew安装时,一般直接在终端直接输入命令:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


但是这个方法在网络有问题时会报如题这个错误。
这个时候直接将文件brew_install.rb下载,然后控制台运行ruby brew_install.rb命令即可。此文件下载地址:
链接:https://pan.baidu.com/s/1rVh8bY73NLc77cQYN_2HoQ 密码:n3si

 

在这里插入图片描述————————————————

Homebrew换源

 

1. 替换brew.git:
$ cd "$(brew --repo)"
中科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
清华:
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

2. 替换homebrew-core.git:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

中科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

清华:
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git


3. 替换homebrew-bottles:

中科大:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile

清华:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile

$ source ~/.bash_profile

4. 应用:
$ brew update

 


原文链接:

https://blog.youkuaiyun.com/sinat_27741463/article/details/102950077

https://blog.youkuaiyun.com/d940319760/article/details/94446136

评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值