What you're installing and why
Node.js is a runtime that lets you run JavaScript outside the browser — on your computer, on servers, or in command-line tools. When you install Node, you get two things: the Node runtime itself, and npm (Node Package Manager), which handles downloading and managing code libraries your projects depend on.
Most JavaScript developers on Mac use Node for local development — testing code before it goes live, running build tools that process your files, or building backend services. You'll know you need it when a project's setup instructions say "install Node" or when you see a file called package.json in a project folder.
There are three main ways to install Node on Mac: downloading the installer directly from nodejs.org, using Homebrew (a package manager for Mac), or using a version manager like nvm. The method you choose depends on whether you want to switch between Node versions often or keep things simple.
Key Takeaways
- Node.js includes both the runtime and npm, so one installation gives you both tools.
- The official installer from nodejs.org is the simplest route if you only need one Node version.
- Homebrew is faster if you already use it for other Mac software, but requires Homebrew to be installed first.
- A version manager like nvm is worth learning if you work on multiple projects that need different Node versions.
- After installation, run node --version and npm --version in Terminal to confirm both are working.
Installing Node with the official installer
Go to nodejs.org and you'll see two download buttons. Choose the LTS (Long Term Support) version unless a specific project requires the Current version. LTS releases get security updates for years; Current versions change every few months. Download the macOS installer.
Open the downloaded .pkg file and follow the installer steps. It will ask where to install Node (the default location is fine) and may ask for your Mac password. The installer places Node and npm in standard system locations so Terminal can find them automatically.
When the installer finishes, open Terminal (find it in Applications > Utilities or search for "Terminal") and type node --version. You should see a version number like v20.10.0. Then type npm --version to confirm npm installed too. If both commands show version numbers, you're done.
Installing Node with Homebrew
If you already use Homebrew on your Mac, installing Node through it is faster than downloading an installer. Homebrew is a package manager — it downloads and installs software from the command line.
Open Terminal and type brew install node. Homebrew will download and install Node and npm automatically. When it finishes, run node --version and npm --version to confirm both are working.
The advantage of Homebrew is speed and consistency — you manage Node the same way you manage other tools. The disadvantage is that Homebrew installs only one version of Node at a time. If you need to switch between versions for different projects, you'll need to uninstall and reinstall, which is slower than using a version manager.
Using nvm to manage multiple Node versions
nvm (Node Version Manager) lets you install multiple Node versions and switch between them instantly. This matters if you work on older projects that need Node 14 and newer projects that need Node 20 — you can have both installed and pick which one to use.
To install nvm, open Terminal and paste this command: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash. Then close Terminal completely and open it again. Type nvm --version to confirm nvm installed.
Once nvm is installed, type nvm install --lts to install the latest LTS version of Node. To install a specific version, type nvm install 18.0.0 (replace with the version you need). To see all installed versions, type nvm list. To switch versions, type nvm use 18.0.0.
nvm is more complex to learn than the other methods, but it's the standard choice for developers who work on multiple projects. Once you're comfortable with it, switching Node versions takes one command.
Checking your installation and next steps
After installation, verify both Node and npm are working by opening Terminal and running these two commands separately:
- node --version (should show something like v20.10.0)
- npm --version (should show something like 10.2.0)
If both commands show version numbers, Node is installed correctly. If you get "command not found", the installation didn't complete or Terminal can't find Node. Try closing Terminal completely and opening it again — sometimes Terminal needs to restart to recognize new software.
Once Node is working, you can start a new project by creating a folder, opening Terminal in that folder, and typing npm init. This creates a package.json file that tracks your project's dependencies. From there, you can install libraries with npm install and run your code with node filename.js.
Troubleshooting common installation problems
If Terminal says "command not found" after installation, the most common cause is that Terminal doesn't know where Node is located. Try closing Terminal completely (not just the window — use Command+Q) and opening it again. Sometimes Terminal needs to restart to recognize newly installed software.
If you installed Node with the official installer and it still doesn't work, check that the installer completed without errors. Open System Preferences > Security & Privacy and look for any messages about the installer being blocked. If you see one, click "Allow" and try installing again.
If you installed with Homebrew and npm works but Node doesn't, or vice versa, try running brew reinstall node. If you installed with nvm and can't switch versions, make sure you're using the correct syntax: nvm use 18.0.0 (with the full version number), not just nvm use 18.
Frequently Asked Questions
Should I use LTS or Current version?
Use LTS unless a project specifically requires Current. LTS versions receive security updates for years and are stable for production work. Current versions get new features every few months but stop being supported quickly. Most developers and projects use LTS.
Can I have multiple Node versions installed at the same time?
Only with nvm. The official installer and Homebrew replace the previous version when you install a new one. If you need to switch between versions often, nvm is worth the extra setup time.
Do I need to install npm separately?
No. npm comes automatically with Node, whether you install through the official installer, Homebrew, or nvm. Running npm --version after installing Node should show a version number immediately.
What's the difference between Node and npm?
Node is the runtime that executes JavaScript code. npm is the package manager that downloads libraries and tools your code depends on. They're separate programs but installed together, and you need both for most JavaScript projects.
How do I uninstall Node if I need to start over?
If you used the official installer, go to Applications > Utilities > Terminal and run sudo rm -rf /usr/local/lib/node_modules/npm /usr/local/bin/node. If you used Homebrew, run brew uninstall node. If you used nvm, run nvm uninstall --lts to remove a version, or follow nvm's documentation to remove nvm itself.