折腾:
【未解决】Win的VMWare的macOS中安装Python3
期间,继续去,Win中VMWare的虚拟机macOS中,安装homebrew
先是遇到:
【已解决】Win中VMWare的macOS安装brew报错:curl 7 Failed to connect to raw.githubusercontent.com port 443 Connection refused
继续:
crifanlideMac:~ crifanli$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh )" ==> This script will install: /usr/local/bin/brew /usr/local/share/doc/homebrew /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew /usr/local/etc/bash_completion.d/brew /usr/local/Homebrew ==> The following new directories will be created: /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Homebrew /usr/local/Frameworks ==> The Xcode Command Line Tools will be installed. Press RETURN to continue or any other key to abort

即可。
不过貌似被打断了。
重新试试

继续安装XCode的command line tools
继续等待。
后来是:
【已解决】macOS安装homebrew卡死在:Cloning into /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
即可。
【总结】
此处Win中VMWare的虚拟机macOS中安装homebrew过程是:
(1)确保访问raw.githubusercontent.com不会出现DNS问题,所以去给hosts加上IP映射
macOS中
vi /etc/hosts
去加上:
# github 151.101.76.133 raw.githubusercontent.com
注:
其中的
的实际IP地址,可以通过DNS查询网站:
查到。
(2)用速度很快的国内(比如中科大)的源去安装homebrew
背景:
官网的homebrew安装命令:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
内部会去下载
但是速度会慢到卡死
所以建议换用国内的其他的源,比如速度很快的中科大的源。
步骤:
单独下载homebrew-core
cd "$(brew --repo)/Library/Taps/" mkdir homebrew && cd homebrew git clone git://mirrors.ustc.edu.cn/homebrew-core.git
同样的,单独下载homebrew-cask
cd "$(brew --repo)/Library/Taps/" cd homebrew git clone https://mirrors.ustc.edu.cn/homebrew-cask.git
换别人命令(内部主要就是换了源),去安装homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
会很快,此处没到2分钟,就完成了,会看到显示:==> Installation successful!
最后去更新一下
brew update
另外,为了以后用brew安装东西快,把整个brew的源都换成中科大的:
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git brew update
以及长期替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile
注:根据你的实际情况,把
~/.bash_profile
换成你自己的macOS的启动脚本,比如
~/.bashrc
~/.zshrc
等。
具体过程详见:
【已解决】Windows中浏览器打开raw.githubusercontent.com报错: 错误代码 DNS_PROBE_POSSIBLE
【已解决】Win中VMWare的macOS安装brew报错:curl 7 Failed to connect to raw.githubusercontent.com port 443 Connection refused
【已解决】macOS安装homebrew卡死在:Cloning into /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core