How to install nvm (Node Version Manager)  in MAC

  • Download nvm.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  • Get ready your terminal to conside nvm command. Open zshrc file by running the following command:
nano ~/.zshrc
  • Paste the following code there:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
  • Hit CTRL+O, CTRL + return to save the file.
  • Restart the Terminal.
  • You will be able to use nvm package now.
  • Verify the nvm installation by running the following command:
command -v nvm
  • The output should nvm in return
nvm