Logo
Published on

Managing Multiple Node Versions on macOS with NVM (Node Version Manager)

Authors

💡 Introduction:

If you work with JavaScript or Node.js projects, you've probably run into this:

This app needs Node 14… but the other one needs Node 18. Sound familiar?

Instead of uninstalling and reinstalling Node versions (painful!), let me show you a simple tool that makes managing multiple versions super easy on macOS:

👉 NVM (Node Version Manager)

🔧 What is NVM?

NVM is a lightweight tool that lets you install and switch between multiple versions of Node.js with just a few terminal commands.

It’s perfect if:

  • You're working on multiple projects with different Node requirements
  • You want to test your app in different Node versions
  • You love clean, flexible dev environments

🖥️ Installing NVM on macOS

Step 1: Open Terminal

Step 2: Install via curl or wget

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

Or if you use wget:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Step 3: Add NVM to your shell config Make sure this is in your ~/.zshrc (or ~/.bashrc):

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

Then restart your terminal or run:

source ~/.zshrc

✅ Now check if it’s installed:

nvm --version

📦 Installing and Switching Node Versions

Install any Node version:

nvm install 18
nvm install 16

List installed versions:

nvm ls

Switch to a specific version:

nvm use 16

Set a default version:

nvm alias default 18

💡 Bonus Tips

  • You can create a .nvmrc file in your project folder with a version like 18, and then just run:
nvm use
  • Use nvm uninstall <version> to remove an old version you're not using.

🐝 Why I Use NVM in My Workflow

For someone like me—who’s often exploring different front-end stacks and tools—NVM is a lifesaver. No more version conflicts, no more uninstall headaches. Just smooth switching and happy coding.