joseverissimo
Published 4 Apr, 2020

Install NVM on zsh (macOS Catalina)

With the latest macOS update comes zsh (or z shell) and with it comes some issues, one of them is how complicated it is to install NVM so here is how to do it.

Before you get started, make sure that you have zsh as your current running shell, to do so run the following in your terminal: echo $0, if you're using zsh then you should see the following output -zsh.

Start downloading and running the install script for NVM, you can find more about this in its repo (https://github.com/nvm-sh/nvm):

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

After the installation, you'll need to add the code below to the startup file, this sets up the alias for NVM to make sure that it's always available on your shell even after it was closed and opened again

Bash
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

Open the startup file using nano, paste the code above then save the file.

Bash
nano ~/.zshrc

Open a new terminal window and test your nvm installation by running nvm --version.