[MAC] Install nvm
Remember the Homebrew? In case you missed to install this earlier, please refer to the lesson Mandatory Mac Installations for the prework. We will be using brew command to install the nvm.
nvm is a terminal command that allows you to install and change between different versions of Node.js. Usually, your system can have only one version of Node.js installed at one time. With nvm, you can switch to a newer version, try some new features, and then back to an older version for your more serious projects.
- Run these commands one by one in your terminal:
$ mkdir ~/.nvm
$ brew install nvm
- Use your editor to open your terminal settings file (
.zshrc
or.bash_profile
):
$ code ~/$([ -n "$ZSH_VERSION" ] && echo ".zshrc" || echo ".bash_profile")
- In your editor, copy/paste these lines and save:
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion" # This loads nvm bash_completion
- Close and reopen all your terminal windows.