Install Node on Mac: A Complete Step-by-Step Guide
Learn how to install Node.js on macOS using Homebrew or NVM. This educational guide covers prerequisites, setup, verification, and troubleshooting to get you coding fast.

By the end of this guide, you will have Node.js installed on your Mac and verified. You can choose your path: install with Homebrew for a simple setup, or install with Node Version Manager (NVM) for managing multiple versions. Both paths include installation, environment setup, and a quick test to confirm success.
Why Node on mac matters
According to Install Manual, macOS remains a popular development environment due to its UNIX-based core, robust toolchain, and strong community support. A clean Node.js installation on a Mac sets developers up for consistent workflows across projects and teams. The Install Manual team found that most Mac users want a reliable setup that stays stable across updates and minimizes surprises during development. Node.js powers servers, build tools, and CLI utilities that fuel modern JavaScript applications. Whether you program in React, Vue, or backend services with Express, having Node ready on macOS accelerates the path from idea to running code. This guide uses practical methods you can apply today without getting bogged down in jargon. It also emphasizes safety and maintenance so your environment remains healthy as you grow.
As you read, you’ll encounter two common paths—Homebrew and NVM. Each has trade-offs: Homebrew is straightforward for a single Node version; NVM excels at managing multiple versions per project. The choice depends on your goals, team needs, and how you like to structure your toolchain. Throughout, you’ll see concrete commands you can copy-paste in Terminal, with explanations of why each step matters and how to verify success before moving on.
If you are new to macOS development, keep in mind that working with Terminal requires careful attention to PATH variables and shell configuration. Small misconfigurations can hide deeper problems, so this guide provides checks and troubleshooting tips to prevent common roadblocks. As you progress, you’ll build confidence in managing Node versions and npm packages without destabilizing your system. This approach aligns with best practices recommended by the Install Manual team for long-term reliability.
Choosing an installation method
There isn’t a single “one-size-fits-all” path to install Node on macOS. The most common routes are Homebrew for a streamlined, system-wide installation and Node Version Manager (NVM) for flexible version management across multiple projects. Homebrew can install Node directly and keep it updated with simple commands, which is convenient for solo projects or quick setup. NVM, by contrast, lets you install and switch between many Node versions without touching the system Node, which is ideal for developers who juggle legacy apps and new experiments. The Install Manual analysis shows that developers benefit from having both options in mind, choosing the approach that matches their workflow.
Key considerations include: your need to run specific Node versions for different projects, collaboration with teams that require uniform environments, and how often you update your toolchain. If you anticipate working on multiple projects with varying Node requirements, NVM is typically the better long-term strategy. If you want a fast, simple setup for a single project or a quick prototype, Homebrew offers a fast path with fewer moving parts. In either case, you’ll gain a working Node environment that enables npm, package installation, and script execution.
Security and maintenance are important too. Keep your macOS up to date, review npm permissions, and avoid running commands as the root user whenever possible. The goal is a stable, predictable environment you can rely on for weeks and months, not just a quick start. As you prepare to install, decide which method aligns with your project goals and team needs, then proceed with the steps that follow.
Installing via Homebrew
Homebrew is a popular package manager for macOS that simplifies the installation and updating of software, including Node.js. This section walks you through installing Homebrew (if it isn’t already installed), then using it to install Node. Homebrew keeps dependencies orderly and makes future updates straightforward. If you already rely on Homebrew for other development tools, this path is natural and efficient. The commands below assume you’re using the default zsh shell on recent macOS releases, but they work in bash as well.
First, verify whether Homebrew is installed by running brew --version. If you don’t see a version number, install Homebrew with the official script from https://brew.sh/. After installation, you can install Node with brew install node. This will pull the Node runtime and npm together. Once the installation completes, verify the results by running node -v and npm -v to confirm versions are reported. If you encounter permission issues, avoid using sudo with npm; instead, adjust directory ownership or use a version manager like NVM for future projects. Regular updates can be performed with brew update and brew upgrade node, which keeps your setup aligned with the latest LTS releases.
The Homebrew path is straightforward and has broad community support. It’s a solid starting point for developers who want a fast setup and easy maintenance. If you prefer a minimal, system-wide Node accessible to all shells and scripts, this route is typically sufficient. Remember to restart your terminal or run source ~/.zshrc (or your shell profile) after installing to ensure PATH is updated and programs can be found.
Installing via NVM
Node Version Manager (NVM) is a script-based utility that lets you install and switch between multiple Node.js versions without touching the system-wide installation. NVM is especially valuable when you work on projects with different Node requirements or when testing across several Node versions. The recommended approach is to install NVM, load it in your shell, then install a specific Node version using nvm install --lts for the latest long-term support release, followed by nvm use --lts to switch to that version.
To install NVM, you typically run the official install script from the NVM repository: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash or wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash. After installation, you’ll need to restart your terminal or source your profile file (e.g., source ~/.bash_profile or source ~/.zshrc) so that nvm is available in your session. Then install Node with nvm install --lts and set the default with nvm alias default. This method offers excellent flexibility for maintaining multiple Node environments on the same machine.
Note: If you use a shell other than bash or zsh, you may need to add the NVM initialization lines to your shell’s startup file. Once installed, you can switch versions quickly with nvm use 14.x or nvm use --lts, and you can list installed versions with nvm ls. The ability to switch versions on the fly is a major advantage when supporting diverse projects or teaching environments.
Verifying installation and common issues
After completing either installation path, verify Node and npm are accessible in your Terminal. Run node -v to see the Node version and npm -v to confirm the npm version. If commands aren’t found, double-check your PATH or reload your shell. For Homebrew, ensure that /usr/local/bin (Intel) or /opt/homebrew/bin (Apple Silicon) is in your PATH, depending on your setup. For NVM, ensure nvm is loaded in your shell session and that you’re using the intended version (nvm use --lts).
Common issues include conflicts with an existing system Node, permissions errors when installing global npm packages, and PATH misconfigurations. If npm prints a permissions error, avoid using sudo to install global packages. Instead, adjust ownership of the npm global directory or configure npm to use a user-writable directory. When Apple Silicon users see architecture-related warnings, confirm you installed arm64 builds, or rely on NVM to pick the correct version for your chip. By following these checks and fixes, you’ll resolve most installation hiccups and have a working Node environment quickly.
Automating updates and switching versions
Keeping Node and npm up to date is important for security and performance. If you rely on Homebrew, you can run brew upgrade node periodically to receive the latest Node release. If you use NVM, you can install newer major versions with nvm install node or install specific versions with nvm install 18.15.0 (example placeholder) and switch with nvm use 18.15.0. To make a version the default, use nvm alias default 18.15.0. Consider creating a project-specific .nvmrc file that pins a Node version and using nvm use when you enter the project directory. This keeps your environment consistent across machines and teammates. Finally, keep npm itself up to date with npm install -g npm, ensuring you have the latest package management features and security fixes.
Tools & Materials
- Mac computer (Apple hardware) with macOS 10.15+ or newer(Ensure you have admin access for installations.)
- Active internet connection(Stable connection recommended for downloads and updates.)
- Terminal app (preinstalled on macOS)(You will run commands in Terminal or iTerm2.)
- Homebrew package manager(Recommended for the Homebrew method; install from brew.sh.)
- Node Version Manager (NVM)(Recommended for managing multiple Node versions; use the official install script.)
- Optional: Node.js installer from nodejs.org(If not using Homebrew or NVM.)
Steps
Estimated time: 20-40 minutes
- 1
Decide installation path
Determine whether you will install Node via Homebrew for a quick setup or use NVM to manage multiple versions. Your choice should align with project needs and future maintenance. If you expect working on multiple Node versions, choose NVM; otherwise, Homebrew is perfectly adequate.
Tip: Consider future projects and team requirements when choosing between a single-version brew path and multi-version NVM. - 2
Install Homebrew (if not already installed)
Open Terminal and run the official installation command from brew.sh. After installation, run brew doctor to check for any configuration warnings and ensure brew is ready to install other software.
Tip: Restart the Terminal or source your shell profile to refresh PATH. - 3
Install Node with Homebrew
Run brew install node to install Node.js and npm together. After installation, verify with node -v and npm -v to confirm versions are reported and usable.
Tip: If you encounter permissions issues, consider adjusting directory ownership rather than using sudo with npm. - 4
Verify installation
Test Node by running node -e "console.log('hello from node')" and npm init -y in a test project folder. These quick checks confirm the runtime and package manager are functioning.
Tip: Create a small test file and run it to validate your environment end-to-end. - 5
Install NVM (if using NVM path)
Run the official NVM install script from the repository, then restart your terminal to load NVM. Verify by running nvm --version.
Tip: If your shell doesn’t recognize nvm, ensure the initialization lines were added to your shell profile. - 6
Install a Node version via NVM and set default
Use nvm install --lts to install the latest LTS release, then set the default with nvm alias default --lts. Confirm with node -v and npm -v.
Tip: Switch contexts with nvm use --lts when you enter different projects. - 7
Test with a small Node script
Create a test file test.js that prints a message, then run node test.js to ensure code execution works as expected in the chosen setup.
Tip: Keep a simple test script handy for quick sanity checks.
Got Questions?
Do I need Homebrew to install Node on Mac?
No. You can install Node using either Homebrew or the official Node installer, and you can also use NVM to manage versions. Homebrew offers a straightforward single-version path, while NVM provides flexibility for multiple projects.
You can install Node on Mac without Homebrew by using the official installer or NVM.
Which installation method is best for multiple projects?
For multiple projects, NVM is typically best because it lets you switch versions without affecting system-wide Node. It keeps project environments isolated and reproducible.
If you work on multiple projects, NVM is the recommended path.
What is the difference between Node and npm?
Node is the JavaScript runtime that executes code; npm is the package manager used to install, manage, and publish libraries. Node provides the platform, npm handles dependencies.
Node runs your code; npm installs packages.
What should I do if the 'node' command isn’t found after install?
Check that your PATH includes the Node binary, then restart the terminal. If you use NVM, ensure you’ve loaded the correct version with nvm use. Reopen your shell or source your profile file if needed.
Make sure PATH is updated and try re-opening the terminal.
Can I install Node on Apple Silicon Macs?
Yes. Node supports Apple Silicon. Use the arm64 build when available or rely on NVM to automatically pick the correct version for your chip.
Yes, Node works on Apple Silicon; choose the proper build or rely on NVM.
Watch Video
Main Points
- Choose Brew or NVM based on needs
- Verify installs with node -v and npm -v
- Use NVM to manage multiple Node versions
- Keep Node and npm up to date to avoid issues
