Install nodejs with nvm on OSX

There 3 different ways to install Node.JS on OSX, in this post I will provide instructions on how to do it using Node Version Manager.

For easier instructions on how to install NVM on MacOS check out my company blog post

Install NVM on MacOS

Why Node Version Manager (NVM)

Node.JS is a popular framework for the developing applications and has been available since 2009.  As with any software development frameworks node is under constant development, with the team making improvements, bug fixes and has undergone it own fair share of forking and merging. This will result in different versions of the software available.

NVM is similar to Ruby’s RVM, allowing you to install and switch between different versions of Node.JS and NPM using the command line. It’s super useful to developers especially if you have to support applications which have been developed utilising different versions of the framework.

Installing Node using NVM on  OSX

Node Version Manager (NVM) lets you install multiple versions of Node.js to your local user directory, enabling easy upgrades and version switching, without the permission troubles that are common with non-NVM setups.

If you have previously installed Node on your Macbook, you will need to uninstall. If you have installed node using HomeBrew  .

Install HomeBrew on Mac

If you have previously installed node using HomeBrew, ensure that you uninstall it before you proceed

To install NVM, we will need to clone to the Git repository

Once complete you can check which version of of nvm has been installed

We can now install any node version we desire.

We can now easily switch between different versions of node

We can also check which version of node is currently in use by

We can also check which versions of node are available in your nvm instance by

There are a number of benefits to making use of NVM on your development machine, not only can you host multiple versions of the node framework on your machine but also ensure you no longer require to use sudo to install npm packages – Which is a really good thng when it comes to security of your machine!

Gary Woodfine

Helps businesses by improving their technical proficiencies and eliminating waste from the software development pipelines. A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.