系统环境
macOS Catalina
10.15.5 (19F101)
安装方式
-
打开终端(Terminal)
-
进入当前用户的home目录
cd ~
-
创建.bash_profile文件
touch .bash_profile
-
输入安装nvm的命令
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
-
安装完成后,创建~/.zshrc并打开文件编辑
vim ~/.zshrc
-
在文件中添加以下内容:(让系统每次都自动执行~/.bash_profile文件)
source ~/.bash_profile
-
保存退出文件,关掉terminal后再重启
-
输入命令,nvm list,有内容显示,则安装成功
遇到的坑
报错
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
解决方法
- 网上查询 raw.githubusercontent.com 的真实IP
得到的结果是:199.232.68.133 - 打开终端(Terminal)
- 打开hosts文件(ip地址与域名快速解析的文件)
sudo vim /etc/hosts
- 在文件尾部添加内容如下:
199.232.68.133 raw.githubusercontent.com