🧙‍♂️ Easy Guide: Installing NVM on macOS for Developers

Amardeep PhuleAmardeep Phule
2 min read

If you're a developer on macOS and juggling multiple versions of Node.js, NVM (Node Version Manager) is a must-have tool in your toolkit. It lets you install, switch, and manage different versions of Node effortlessly.

Here’s a clean, no-fluff guide to getting NVM up and running on your Mac.

Step 1: Open Terminal

Let’s start simple. Open your Terminal. You can find it via Spotlight (Cmd + Space, then type Terminal) or go to Applications > Utilities > Terminal.

Step 2: Install NVM via Curl

You’ll use the curl command to download and install NVM. Copy and paste this into your terminal:

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

✅ This command pulls the latest official version (as of now) from the NVM GitHub repo. You can find latest version here NVM Latest.

Step 3: Configure Your Shell

Depending on the shell you're using (likely zsh or bash), you'll need to update your profile file so your system knows about NVM.

For Zsh (default on macOS Catalina and later):

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Add those lines to your ~/.zshrc file:

nano ~/.zshrc

Paste the lines at the bottom, save with Ctrl + O, then exit with Ctrl + X.

For Bash:

Add the same lines to your ~/.bash_profile or ~/.bashrc.

Step 4: Refresh the Terminal

After editing your profile file, reload it:

source ~/.zshrc

(or source ~/.bash_profile depending on your shell)

This reloads your profile and makes NVM available immediately.

Step 5: Confirm NVM is Installed

Run this to verify:

nvm --version

If you see a version number (e.g. 0.40.2), you're good to go!

Step 6: Install Node.js with NVM

You can now install Node.js using NVM. For example, to install the latest LTS version:

nvm install --lts

Or install a specific version:

nvm install 18

And switch between versions like:

nvm use 18

Want to make one your default?

nvm alias default 18

🎉 That’s It!

You’ve now got NVM installed and ready to manage Node.js versions like a pro. No more global version conflicts, no more Node-induced headaches. Just smooth sailing from here on.

0
Subscribe to my newsletter

Read articles from Amardeep Phule directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Amardeep Phule
Amardeep Phule