How to Update Node Version on Mac in 2022

Node.js version 18.3.0 is currently the latest, and yours might differ depending on when you read 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 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 so is 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 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 the latest version to work with other JS libraries and frameworks.

Even node.js is improving from its 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 you.

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

N is an npm-based node version manager. I assume that you already have some version of the node installed on your machine. You can install the first node version and then run the following command.

sudo npm install -g n.

Assuming you have successfully installed n. It is the simplest way.

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 version on Mac

To update Node version on Mac, use the brew upgrade node command. The Homebrew is one of the popular package managers for MacOS. If you are using Mac, Homebrew is the package manager you can use to install different packages.

Assuming you have previously installed node with. Then, 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 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 into 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.

Related posts

What is npm


How to Setup Node Express and MongoDB in Docker

How to create a node.js server

1 thought on “How to Update Node Version on Mac in 2022”

  1. 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 Comment

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