Node.js is an open-source, cross-platform, JavaScript runtime platform that enables JavaScript for server-side scripting to produce dynamic web pages before sending them to the client’s web browser. Node.js is built on Chrome’s V8 JavaScript engine. Node.js allows the creation of Web servers and networking tools using JavaScript. It also creates a collection of “modules” that handle various core functionalities like file system I/O, networking (DNS, HTTP, TCP, TLS/SSL, or UDP), and binary data (buffers), cryptography functions, data streams, and other core functions.
Read this => How to Install Homebrew on macOS
This tutorial will help you to install Node.js and NPM on the MacOS system using the Homebrew package manager.
Prerequisites
Before starting the installation of Node.js and NPM using this tutorial you must have the following prerequisites
- Terminal: You must have Mac Terminal access and little knowledge about working with the terminal application. Ao login to your Mac system and open terminal
- Homebrew: Homebrew is a popular package manager for Mac operating systems. It is useful for installing most open-source software like Node
Install Node.js on MacOS
Let’s start the installation of Node.js on your Mac system using Homebrew. So first update the Homebrew package manager index. Then you can install the Node.js package in your MacOS system using the following command:
brew update brew install node
You have successfully installed Node.js on your system. The default Node.js will be installed under the /usr/local/Cellar/node directory on your system. Now check and verify the installed version of Node.js, Execute the below command on the terminal. This will show you the installed version info.
node -v v19.2.0
Also, find the installed version of NPM installed with Node.js. NPM is used for managing modules of Node.js on your system.
npm -v 8.19.3
The above output shows that you have installed Node.js version 18.7.0 and NPM 7.13.0 on your macOS system.
Upgrade Node.js on macOS
The newer versions of Node.js are released very frequently. You can use Homebrew to update Node on your system. Just execute the below commands to update the Homebrew index and then update Node.js.
brew update brew install node
Uninstall Node.js on macOS
You can simply use the Homebrew package manager to uninstall Node packages from your system. Just execute the below command from the terminal.
brew uninstall node
1 Comment
Your “Update Node.js on MacOS” is incorrect – it should read:
brew upgrade node