Mac Homebrew超坑爹的地方

一、安装失败

二、解决问题

三、发现了新大陆!

安装失败

开始在终端里使用官网的安装脚本:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
==> Downloading and installing Homebrew...


fatal: unable to access 'https://github.com/Homebrew/brew/': SSL: no alternative certificate subject name matches target host name 'github.com'
Failed during: git fetch origin --force

 此时我ping github.com是能ping通的!

解决问题

开始百度

网上都说下载brew的安装脚本到本地
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
然后找到brew_install文件,然后将
BREW_REPO="https://github.com/Homebrew/brew”.freeze
替换为
BREW_REPO=“https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git”.freeze

然而

我下载的brew_install文件却是这样的

#!/usr/bin/ruby

STDERR.print <<EOS
Warning: The Ruby Homebrew installer is now deprecated and has been rewritten in
Bash. Please migrate to the following command:
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

EOS

Kernel.exec "/bin/bash", "-c", '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'

 根本就没有BREW_REPO

这就很坑爹了!跟网上按流程来执行的不一样呀!!这就是让我很郁闷的地方 

于是开启了漫长的各种解决方案,都无功而返。

偶然间灵机一动,把从官网下载下来的brew_install文件仔细读了一下,发现里面有句/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
curl应该是获取对应url资源的。于是我贴chorme里看了下!!

发现了新大陆!

 如上图,就是brew_install文件里边的内容!

于是我再按照网上说的那种流程走,把里边的内容全部复制到brew_install里边去;
并且
BREW_REPO="https://github.com/Homebrew/brew"替换BREW_REPO="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"

终端terminal里运行/bin/bash ./brew_install
!!搞定!!
最后执行brew update
或者爱干哈干哈去啦!
 
原文地址:https://www.cnblogs.com/wangcheng9418/p/13128791.html