1. 安装 Homebrew

a. 修改hosts

打开网站https://www.ipaddress.com/
查询一下 raw.githubusercontent.com对应的IP 地址,修改 sudo vim /etc/hosts 文件,添加

199.232.68.133 raw.githubusercontent.com

b. 执行远程脚本

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

2. 安装 node

a. 安装nvm命令

版本命令更新地址 https://github.com/nvm-sh/nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" 
[ -s "$NVM_DIR/nvm.sh" ] && ./"$NVM_DIR/nvm.sh" 

nvm install node

b. 选择安装 zsh

  • 终端zsh
zsh --version
brew info zsh
brew install zsh
#重新打开终端查看版本
  • 代码补全
brew install zsh-completions
#创建配置文件,运行 
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
  • ohmyzsh 美化终端

软件地址 https://github.com/ohmyzsh/ohmyzsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
chsh -s $(which zsh)
#确认默认 Shell,运行xx
dscl localhost -read Local/Default/Users/$USER UserShell

source ~/.bash_profile


沧浪水
97 声望12 粉丝