npm comes bundled with Node.js, so installing Node installs npm too. On a Mac you can use the installer from nodejs.org, run brew install node, or use a version manager such as nvm or fnm. A version manager is the safest choice for developers because it avoids permission errors and switches versions per project.
| Method | One-line install | Switch versions? | Best for |
|---|---|---|---|
| Official installer | Download from nodejs.org | No | One version, no terminal setup |
| Homebrew | brew install node | Only via node@24 style formulae | People who already use Homebrew |
| nvm | curl script from the nvm README | Yes | Most projects, widest documentation |
| fnm | brew install fnm | Yes, automatic on cd | Fast shells, .node-version files |
Updated
Every Mac Node.js tutorial picks one method and skips the others, then leaves you stuck when npm complains about permissions. This page puts all four side by side with the commands checked against each project's own docs, a picker that prints only the steps you need, and an error fixer for the messages people hit most.
https://nodejs.org/en/downloadnode -v
npm -vmkdir -p ~/.local
npm config set prefix ~/.local
echo 'PATH=~/.local/bin:$PATH' >> ~/.profile
echo 'source ~/.profile' >> ~/.zprofile
source ~/.profilebrew install nodebrew install node@24node -v
npm -v
which nodecurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bashnvm install --lts
nvm alias default 'lts/*'echo "24" > .nvmrc
nvm use
node -vbrew install fnmecho 'eval "$(fnm env --use-on-cd --shell zsh)"' >> ~/.zshrc
source ~/.zshrcfnm install --lts
node -v
npm -vnpm tried to write to a system folder. Do not use sudo. Either switch to nvm or fnm, or set npm's prefix to ~/.local as shown in the installer steps, then reinstall the global package.
The shell cannot find the binary. Open a new Terminal window first. If it still fails, run which node, and check that the PATH line from Homebrew or the setup line from your version manager is in ~/.zshrc.
nvm is a shell function loaded by lines the installer adds to your profile. Open a new window, or make sure ~/.zshrc exists before running the installer, then run it again.
The package asks for a different Node.js version than the one running. Check node -v, install the version the project needs, and pin it with .nvmrc or .node-version.
Node.js works; another process already holds the port. See the localhost:3000 guide for the commands that find and stop it.
| Version | Codename | Status |
|---|---|---|
| v26 | None yet | Current |
| v24 | Krypton | LTS |
| v22 | Jod | LTS |
| v20 | Iron | End of life |
List what is installed, install another version, and switch the current shell to it.
nvm ls # installed versions
nvm install 22 # add the latest v22
nvm use 22 # switch this shell
nvm alias default 24The same tasks with fnm. With --use-on-cd in your shell setup, entering a folder that has .node-version or .nvmrc switches for you.
fnm list
fnm install 22
fnm use 22
fnm default 24
The installer is the least work if you need one version for a course or a single tool. It puts node and npm in system folders, which is why global installs can later fail with EACCES.
Homebrew keeps Node with your other command line tools and updates it with brew upgrade. Its main formula tracks the newest release, so use a versioned formula such as node@24 if you want to stay on LTS.
nvm and fnm install each version inside your home folder, so npm never needs sudo, and you can switch versions per project. For development work this is the method that causes the fewest problems.
Open a new Terminal window after installing, then run node -v and npm -v. Each should print a version number. which node shows the folder the shell found it in, which tells you which install is active.
If which node points at /usr/local/bin or /opt/homebrew/bin while you expected a version manager, the shell setup line for nvm or fnm has not run. Check your ~/.zshrc.
Yes. The official installer, the Homebrew formula and both version managers install npm and npx alongside node. You do not need a separate npm download.
The latest LTS line. On nodejs.org in October 2026 that is v24 (Krypton), with v26 still in its Current phase. Frameworks such as Vite and Next.js also publish a minimum version, so check their docs if you use them.
Long Term Support. A release spends about six months as Current, then moves to Active LTS for bug and security fixes, then Maintenance LTS for critical fixes only. The Node.js site says that from version 27 every major release will become LTS, not only the even ones.
The nvm README says a Homebrew install of nvm is not supported and asks you to use its install script instead. fnm, on the other hand, documents brew install fnm as a normal install path.
Run brew uninstall node. If you are moving to a version manager, do this first so the old binary does not shadow the new one on your PATH.
Related: npm commands cheat sheet, pnpm vs npm, Fix localhost:3000, Git cheat sheet, Vite vs Next.js.
Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.
We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.