NodeJSInstall on macOS

Install on macOS

On macOS you can use the official installer, Homebrew, or a version manager. For developers, nvm (if you switch versions) or Homebrew (if you do not) are the recommended choices.

Which method to choose

Method

Best for

Multiple versions?

Homebrew

A single up-to-date version, system-managed

Awkward

nvm / fnm

Switching versions per project

Yes

.pkg installer

No-terminal, point-and-click

No

Option 1: Homebrew (most popular)

If you do not have Homebrew, install it first, then:

Bash
brew install node      # latest Node
node -v && npm -v
Pinning a major with brew
Homebrew installs the *latest* Node by default and will happily upgrade you across major versions on `brew upgrade`. To stay on a line, install a versioned formula — `brew install node@20` — and add its `bin` to your PATH as the `brew` output instructs. Even so, brew is not designed for *switching*; reach for nvm if you do that often.
Option 2: nvm (best for switching versions)

Bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# Restart your terminal, then:
nvm install --lts
nvm use --lts
node -v

See Version Management with nvm for the full workflow, including per-project .nvmrc files.

zsh vs bash profile
Modern macOS uses **zsh** by default, so the nvm installer appends to `~/.zshrc`. If `nvm` is "command not found" in a new terminal, confirm the nvm snippet landed in the profile your shell actually loads (`echo $SHELL`), then `source` it.
Option 3: Official installer (.pkg)
  • Download the macOS .pkg for the LTS release from nodejs.org.

  • Run it and follow the prompts — it installs to /usr/local/bin (Intel) or /opt/homebrew-adjacent paths.

  • Open a new terminal and verify with node -v.

The .pkg can be awkward to remove
The official installer scatters files across `/usr/local` and has no clean uninstaller, which can later collide with a Homebrew or nvm install. For a tidy machine, prefer one method — and if you will ever need multiple versions, start with nvm.
Apple Silicon (M-series)
Native arm64 — no Rosetta needed
Modern Node.js ships native **arm64** builds, so it runs at full speed on Apple Silicon. Homebrew (under `/opt/homebrew`) and nvm both install the correct architecture automatically. Confirm with `node -p "process.arch"` → should print `arm64`. You only need Rosetta if a *native add-on* lacks an arm64 prebuild.
Verify

Bash
node -e "console.log('Hello from macOS + Node')"
Hello from macOS + Node
Next
Configure your editor in [Editor & Dev Environment Setup](/nodejs/editor-setup) and try the [REPL](/nodejs/node-repl).