Install Node.js and NPM in Mac OS


Sometimes, for developing software, Node.js and NPM can be essential. And we might want to have it available on our Mac.

Installing Node.js

My preference for managing packages on Mac is Hombrew (check the official website). Therefore, you could be installing Node.js directly on your Mac, but I would hardly recommend using this package manager. Once you have that installed by checking the official documentation, just run this command to ensure all is properly working to start:

brew -v

The expectation is something like (or newer):

Homebrew 4.0.3
Homebrew/homebrew-core (git revision ba9f2bcd9b5; last commit 2023-02-25)

Once we’ve ensured this is installed, let’s install Node.js by running:

brew install node

Let it run. And now, let’s check the installation by running:

npm -v

And that’s it! We now have Node.js and NPM already installed on our machine.

Uninstall Node.js

If you installed something, you might also need to uninstall it at come point. So here Hombrew comes to the stage again. You’ll be removing Node.js just by running:

brew uninstall node

And check it’s not existing anymore checking the version of NPM. It should be throwing an error as the command was not found.

nom -v

Leave a Reply

Your email address will not be published. Required fields are marked *