Latest Code Tutorials

How to Update Node Version on Mac in 2022

Right now, Node.js version 16.13.2 is the latest, and yours might be different depending on when you are reading this article. Web Development is changing rapidly. Development is picking rapidly, and Node.js is shipping out the new version to almost everyone; therefore, it is nice to have the latest version in your development environment to test out the new features and make it compatible with other Javascript libraries.

Why you should upgrade the node

You have many reasons why you should update the node to the latest version because the Javascript community is getting bigger and bigger, and so does the NPM repository.

All the new JS frameworks and libraries require the latest node.js version because they are built on the newest technology, and to keep up with that. You also need to update all of your outdated libraries, especially Node.js.

Let me give you a scenario, and if you are using the current date’s latest version of React, which is React 16.2.0, and you have a node.js version of, let’s say 9.0, then you won’t be able to even install the React.js project due to some outdated libraries of node.js.

You need to update to the latest version to work with other JS libraries and frameworks.

Even node.js is improving from their previous version, so there are many reasons to upgrade your node.js to the latest version. Getting left behind will be the never option for yours.

How to Update Node Version on Mac

To update node version on mac:

  1. Using N: An npm-based node version manager.
  2. Using Homebrew: Type this command: brew upgrade node
  3. Using NVM: A script-based node version manager.

Update Node using N

It is the simplest way.

N is an npm-based node version manager.

I am assuming that you already have some version of node is installed on your machine.

You can install it by installing the first node version and then running the following command.

sudo npm install -g n.

Assuming you have successfully installed n.

The following command will install the latest version of the node. Please hit that command in admin mode.

sudo n latest

It will install the latest version of Node.js.

Update Node.js using Homebrew

Homebrew is one of the popular package managers for MacOS.

Assuming you have previously installed node with.

With the following command, you can get up-to-date with formulae and upgrade to the latest Node.js version.

brew update
brew upgrade node

It will install the latest version of Node.js.

Update Node using NVM

Nvm is the script-based node version manager.

You can install it easily with the curl and bash one-liner as described in the documentation.

It’s also available on the Homebrew package manager.

You can install NVM using HomebHomebrewg the following command.

brew install nvm

Now the following command will install the latest version of the node.

nvm install node --reinstall-packages-from=node

The last option installs all the global npm packages to your new version.

This way, the packages like mocha and node-inspector keep working.


Upgrading node to the latest version is kid’s stuff, but if you are running in trouble, you can always switch the way to update it.

If you are running in trouble using homebrew, update the homebrew and then install one by one missing dependency. It will work fine only after it has all the required dependencies.

If possible, keep your node.js version updated.

That’s it for this article.

1 Comment
  1. Joe says

    Krunal, thanks for the post.

    When I run ‘sudo n latest’ I receive the following message:
    installed : v13.12.0 to /usr/local/bin/node
    active : v6.13.1 at /Users//miniconda3/bin/node

    How can I update the active Node?

Leave A Reply

Your email address will not be published.

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