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

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. 1. 替换brew.git:

  2. $ cd "$(brew --repo)"

  3. 中科大:

  4. $ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

  5. 清华:

  6. $ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

  7. 2. 替换homebrew-core.git:

  8. $ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

  9. 中科大:

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

  11. 清华:

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

  13. 3. 替换homebrew-bottles:

  14. 中科大:

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

  16. $ source ~/.bash_profile

  17. 清华:

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

  19. $ source ~/.bash_profile

  20. 4. 应用:

  21. $ brew update

发布了172 篇原创文章 · 获赞 45 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/fish_study_csdn/article/details/104179105