Node.js is an open-source, cross-platform JavaScript runtime built on Chromeâs V8 engine. It enables developers to run JavaScript outside the browser and build scalable server-side and real-time applications.
- Used for building server-side applications, web servers, and APIs.
- Runs on macOS, Windows, and Linux using Chromeâs V8 engine.
- Suitable for scalable and real-time networking applications.
NPM
NPM (Node Package Manager) is a package manager for Node.js that helps developers install, share, and manage libraries and tools required for their Node.js applications. Itâs an integral part of the Node.js ecosystem and is automatically installed along with Node.js.
Installation
Follow these steps to install Node.js on your macOS system quickly and correctly.
Method 1: Download and Install Node.js from Official Website
To install Nodejs on MacOS from its official website follow the steps given below.
Step 1: Download the Node.js Installer
Visit the official Node.js website and download the installer. You will see two versions: LTS and Current. Choose the LTS (Long-Term Support) version, as it is stable and recommended for most users.
Step 2: Run the Installer
Run .pkg Installer for Node.js and click "continue" once the wizard is open.

Step 3: Finish the Installation
Follow the on-screen instructions and complete the installation process. After installation completion, this window will show up, click on the "close" button

Step 4: Verifying Node.js Installation
Verify the Node.js Installation by running the following command in the Terminal:
$ node -vIf Node.js was properly installed, you'll see something close to (but probably not exactly) this:

Now you can check the version of the node package manager by executing the following command:
$ npm -v 
Method 2: Install Node.js using Homebrew
Homebrew is the most common package manager used on macOS for managing open-source software. It's easy to use and ensures that you get the latest stable version of Node.js. Let's check them step-by-step to download NodeJS.
Step 1: Install Homebrew
Open Terminal and run the following command to install homebrew version 23.3.0 (if you havenât already):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Step 2: Update Brew
Once Homebrew is installed, make sure itâs up-to-date by using the following command:
brew update
Step 3: Proceed to Install Node.js
Now run the following command to install Node.js:

brew install nodeStep 4: Verify the Installation
Now run the following command to verify the installation:
node -v
npm -v
Method 3: Install Node.js using NVM
NVM (Node Version Manager) is a tool that allows you to install and manage multiple versions of Node.js. It's ideal if you need to switch between different versions of Node.js for different projects.
Step 1: Install NVM
Open Terminal and run the following command to install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
This command installs NVM and sets up the necessary configuration files.
Step 2: Restart Terminal
After the installation, restart your Terminal or run:

source ~/.bashrcAlternatively, for zsh users:
source ~/.zshrcStep 3: Install Node.js with NVM
Now that NVM is installed, you can install the latest LTS version of Node.js:

nvm install 20Step 4: Set a Default Version
If you want to set the default version of Node.js to a specific version, run:
nvm use 18nvm alias default 18
Step 5: Verify Installation
Check the installed version of Node.js:
node -vnpm -v
Method 4: MacPorts to Download and Install Node.js
MacPorts is another package manager for macOS that allows you to install and manage software. If you are using MacPorts, follow these steps to install Node.js:
Step 1: Install MacPorts
If MacPorts isnât installed on your system, you can download it from the official MacPorts website.

Step 2: Install Node.js
Once MacPorts is installed, open Terminal and run:
sudo port install nodejs18
Step 3: Verify Installation
After installation, check the Node.js version:
node -vnpm -v
Updating Node.js on macOS
Update Node.js regularly to access new features and security fixes. If installed from the official site, download and reinstall the latest version.
Case I: If you used Homebrew, you can update Node.js using the following command:
brew upgrade nodeCase II: If you used NVM, you can update Node.js by first installing the latest version
nvm install nodeNow, set it as the default version using:
nvm use nodeLatest Node.js Version Updates (for macOS)
- LTS (v24.x): Stable and recommended for production environments with long-term support and security updates.
- Current (v25.x): Includes the latest features and improvements but has a shorter support cycle.
- NVM: A version manager that lets you install and switch between multiple Node.js versions for different projects.