在安装Homebrew执行命令
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
此时爆出一个错误
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
该问题由于域名解析出问题,换成ip即可
在 网站 查询raw.githubusercontent.com
的真实IP
电脑上修改hosts文件内容
$ sudo vim /etc/hosts
添加内容199.232.28.133 raw.githubusercontent.com
再执行安装命令就可以了
千年以后。。。
又报错了
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
Failed during: /usr/local/bin/brew update --force
还能说什么,获取国外文件如同与外星人取得联系。
一不做,二不休,还是切到国内数据源吧
替换brew.git:
$ cd "$(brew --repo)"
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
替换homebrew-core.git:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换时又提示
cd: no such file or directory: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
那就下载吧
$ git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
好了 继续上面得步骤吧
执行
$ brew update
检查下有没有错误
$ brew doctor
此时在执行brew -v
结果 Homebrew 2.4.0
暂时OK吧,以后还需要什么再补充吧
不喜欢麻烦的,直接开小飞机把数据运回来吧