Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • NodeJS Tutorial
  • NodeJS Exercises
  • NodeJS Assert
  • NodeJS Buffer
  • NodeJS Console
  • NodeJS Crypto
  • NodeJS DNS
  • NodeJS File System
  • NodeJS Globals
  • NodeJS HTTP
  • NodeJS HTTP2
  • NodeJS OS
  • NodeJS Path
  • NodeJS Process
  • NodeJS Query String
  • NodeJS Stream
  • NodeJS String Decoder
  • NodeJS Timers
  • NodeJS URL
  • NodeJS Interview Questions
  • NodeJS Questions
  • Web Technology
Open In App
Next Article:
How to Install ReactJS on MacOS
Next article icon

How to Install NodeJS on MacOS

Last Updated : 12 Dec, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Node.js is a popular JavaScript runtime used for building server-side applications. It’s cross-platform and works seamlessly on macOS, Windows, and Linux systems. In this article, we'll guide you through the process of installing Node.js on your macOS system.

What is Node.js

Node.js is an open-source, cross-platform runtime environment that allows you to execute JavaScript code outside of a web browser. It is built on Chrome’s V8 JavaScript engine and is widely used for developing scalable network applications, web servers, real-time applications, and much more.

Refer to this article to learn more: Node.js Introduction

What is 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.

How to Install Node on MacOS - 4 Methods

Now, we'll go through all the possible steps to understand how to download and install Node.js on MacOS

Table of Content

  • Method 1: Download and Install Node.js from Official Website
  • Method 2: Install Node.js using Homebrew
  • Method 3: Install Node.js using NVM
  • Method 4: MacPorts to Download and Install Node.js
  • Latest Node.js Version Updates (for macOS)

Method 1: Download and Install Node.js from Official Website

Follow the below steps to install Nodejs on MacOS from its official website.

Step 1: Download the Node.js Installer

Download Node.js from this link. You will see two versions: LTS and the latest version. Select the LTS (Long-Term Support) version because it is supported for the long term and is a stable version.

macnode
Node.js Installer

Step 2: Run the Installer

Run .pkg Installer for Node.js and click "continue" once the wizard is open.

mac21
.pkg file

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

nodemac
Complete the Installation

Step 4: Verifying Node.js Installation

Verify the Node.js Installation by running the following command in the Terminal:

$ node -v

If Node.js was properly installed, you'll see something close to (but probably not exactly) this:

nodemac2
Terminal

Now you can check the version of the node package manager by executing the following command:

 $ npm -v 
npmmacos01
npm -v

Thus, by following these 4 simple steps, you can easily download and install node in macOS.

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):

brew
Brew
/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
brew-ready
Update

Step 3: Proceed to Install Node.js

Now run the following command to install Node.js:

brew9
Install nodejs
brew install node

Step 4: Verify the Installation

Now run the following command to verify the installation:

node -v 
npm -v
verify
verify

Your system is now ready for Node.js

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
mac20000
macos

This command installs NVM and sets up the necessary configuration files.

Step 2: Restart Terminal

After the installation, restart your Terminal or run:

restart
Terminal
source ~/.bashrc

Alternatively, for zsh users:

source ~/.zshrc

Step 3: Install Node.js with NVM

Now that NVM is installed, you can install the latest LTS version of Node.js:

mac100001
Node.js
nvm install 20

Step 4: Set a Default Version

If you want to set the default version of Node.js to a specific version, run:

nvm use 18 
nvm alias default 18
mac100002
default

Step 5: Verify Installation

Check the installed version of Node.js:

node -v 
npm -v
nodemac2
verify

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.

default21
Visit the official website

Step 2: Install Node.js

Once MacPorts is installed, open Terminal and run:

sudo port install nodejs18
default
demo

Step 3: Verify Installation

After installation, check the Node.js version:

node -v 
npm -v
nodemac2
verify

How to Update Node.js on macOS

It’s essential to keep your Node.js installation up to date to benefit from the latest features, improvements, and security fixes.

If you installed Node.js via the official website, you can download the latest version manually from the official website and install it.

Case I: If you used Homebrew, you can update Node.js using the following command:

brew upgrade node

Case II: If you used NVM, you can update Node.js by first installing the latest version

nvm install node

Now, set it as the default version using:

nvm use node

Latest Node.js Version Updates (for macOS)

  • LTS Version: The current LTS version of Node.js is 22.12.0
  • Current Version: The latest current version is Node.js 23.3.0, which includes the latest features but may not be as stable as the LTS version.
  • NVM: For users who need flexibility in managing multiple versions of Node.js, NVM is the best choice. It allows for seamless switching between versions, helping you work with different versions for different projects.

Installing Node.js on macOS is easy and can be done using multiple methods, including Homebrew, the official installer, and NVM. By following this guide, you'll have Node.js up and running smoothly on your macOS machine in no time.


Next Article
How to Install ReactJS on MacOS
author
chaudharyakash1422
Improve
Article Tags :
  • Web Technologies
  • Node.js
  • How To
  • Installation Guide
  • how-to-install

Similar Reads

  • How to Install NuPIC on MacOS?
    NuPIC stands for Numenta Platform for Intelligent Computing is a platform that implements the HTM (Hypertext Markup Language) learning algorithm. HTM is a detailed computational theory of the neocortex. At the core of HTM are timeframe continuous learning algorithms.NuPIC is used for a variety of pr
    1 min read
  • How to Install C# on MacOS?
    C# is a programming language that is used for general purposes. But the C# programming language is classified as one of the High-Level programming languages. Unlike the C programming language, the C# programming language can be used in other tasks. There might be a significant similarity between the
    4 min read
  • How to Install ReactJS on MacOS
    Are you looking to set up ReactJS on your Mac? Whether you’re using a MacBook Air, MacBook Pro, iMac, or any macOS version like Monterey, Ventura, Big Sur, or macOS 15 Sequoia, this step-by-step guide is here to help. ReactJS, the popular JavaScript library for building dynamic user interfaces, requ
    4 min read
  • How to Install Node.js on Linux
    Installing Node.js on a Linux-based operating system can vary slightly depending on your distribution. This guide will walk you through various methods to install Node.js and npm (Node Package Manager) on Linux, whether using Ubuntu, Debian, or other distributions. PrerequisitesA Linux System: such
    6 min read
  • How to Install LISP on MacOS?
    Lisp is one of the oldest programming languages. It was invented back in the 1950s by John McCarthy. Lisp is a so-called meta-programming language or a symbolic programming language. It can be used for any sort of task. It's a general-purpose language. It is the second-oldest high-level programming
    1 min read
  • How to Install Julia on MacOS?
    Julia is one of the new programming languages that is becoming popular with time. It is used mainly for scientific data calculations and mathematical analysis. It is becoming popular because it has very fast execution like C and simple syntax like python. It is an open-source language with high perf
    2 min read
  • How to install Solidity on macOS?
    Solidity is a programming language used for writing smart contracts for many platforms of blockchain, the most common of which is ethereum. It is an object-based programming language that runs on EVM (Ethereum Virtual Machine) which executes the smart contracts. Below are the steps to install solidi
    2 min read
  • How to Install Golang on MacOS?
    Before, we start with the process of Installing Golang on our System. We must have first-hand knowledge of What the Go Language is and what it actually does? Go is an open-source and statically typed programming language developed in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson at Google but
    4 min read
  • How to Install Rasterio on MacOS?
    In this article, we will learn how to install Rasterio in Python on MacOS. Rasterio is used to access geospatial raster data. Geographic information systems use GeoTIFF and other formats to organize and store gridded raster datasets such as satellite imagery and terrain models. Rasterio reads and wr
    2 min read
  • How to Install Node.js on Windows
    Installing Node.js on Windows is a straightforward process, but it's essential to follow the right steps to ensure smooth setup and proper functioning of Node Package Manager (NPM), which is crucial for managing dependencies and packages. This guide will walk you through the official site, NVM, Wind
    6 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences