mac 安装 Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
报错
fatal: unable to access 'https://github.com/Homebrew/brew/': Could not resolve host: github.com
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force
解决方案
1. ‘ping github.com`
PING github.com (192.30.255.113): 56 data bytes
64 bytes from 192.30.255.113: icmp_seq=0 ttl=40 time=547.514 ms
64 bytes from 192.30.255.113: icmp_seq=1 ttl=40 time=429.993 ms
64 bytes from 192.30.255.113: icmp_seq=2 ttl=40 time=268.519 ms
^C
--- github.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 268.519/415.342/547.514/114.369 ms
可看到github.com 对应的ip地址 192.30.255.113
2.修改/etc/hosts
sudo vi /etc/hosts
在最后一行添加 192.30.255.113 github.com
3.安装Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"