Nodejs packages

How to switch between versions of Node on Mac with nvm

In this article, we’ll explore how to easily switch between different versions of node using the node version manager (nvm) on MacOS. 

The technologies used in this tutorial are

Step 1 – Install nvm

The first step is to visit the official nvm repository and look through the To install nvm via curl open up your terminal and enter the following command:

curl -o- | bash

Step 2 – Verify nvm Installation

If nvm was installed successfully, the output of the following command will return ‘nvm’

command -v nvm

If you do not see this output above you may have to restart your terminal application. Once you’ve verified you have installed nvm correctly you’re all set to start managing the global versions on node on your mac!

Step 3 – Install & Manage node

If you’re completely new to nvm I highly recommend reading the output of 

nvm --help

to view, all the options nvm have to offer. To download, install, and compile the latest release of node use

nvm install node

or use the following command to install a specific version of node

nvm install 10.12.0

To view the list of node versions you have installed via nvm use: 

nvm list

As you see in this output, I’m using v10.12.0 on my local mac. If I wanted to switch to node v11.3.0 I can simply do:

nvm use 11.3.0

and nvm will automatically configure my local to use node v11.3.0 instead of v10.12.0. 

Final Notes

Hopefully, you found this how-to on managing node versions very helpful. Please let me know if anything here was not clear and I’ll be happy to update this post!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.