Install nvm on Mac OSX
suggest changeINSTALLATION PROCESS
You can install Node Version Manager using git, curl or wget. You run these commands in Terminal on Mac OSX.
curl example:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash
wget example:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash
TEST THAT NVM WAS PROPERLY INSTALLED
Close and reopen Terminal, then run nvm. Current macOS uses zsh, so the installer writes ~/.zshrc. If the shell says nvm: command not found, confirm that file sources nvm, then open a new terminal. The steps below are for bash.
If you still get nvm: command not found, try the following:
- In Terminal, enter
nano .bashrc. You should see an export script almost identical to the following:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
- Copy the export script and remove it from .bashrc
- Save and Close the .bashrc file (CTRL+O – Enter – CTRL+X)
- Next, enter
nano .bash_profileto open the Bash Profile - Paste the export script you copied into the Bash Profile on a new line
- Save and Close the Bash Profile (CTRL+O – Enter – CTRL+X)
- Finally enter
nano .bashrcto re-open the .bashrc file - Paste the following line into the file:
source ~/.nvm/nvm.sh
- Save and Close (CTRL+O – Enter – CTRL+X)
- Restart Terminal and enter
nvmto test if it’s working
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents