Skip to main content
Back to Blog

Mac + nvm: A Must-Know Node Version Management Workflow for Developers

2/23/2026

When moving from Windows to Mac, one of the first tasks is rebuilding your dev environment.

If you already use nvm on Windows, keep doing that on macOS. Many developers still install a single Node version with brew install node and fight version conflicts later. On Apple Silicon Macs, nvm gives a cleaner multi-version workflow.


1) Why nvm?

Typical situations:

  • A legacy project needs Node 14, while a new project needs Node 20.
  • A dependency breaks on your current Node version and rollback becomes messy.
  • Team machines, CI, and production use different Node versions and bugs become hard to reproduce.

nvm solves this by:

  • Running multiple Node versions side by side
  • Switching versions in seconds
  • Isolating versions per project
  • Avoiding system-level pollution

2) Prerequisite

Confirm Homebrew:

brew --version

If missing:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

3) Install nvm with Homebrew

Install nvm:

brew install nvm

Create the nvm directory:

mkdir -p ~/.nvm

Add to ~/.zshrc:

# NVM setup
export NVM_DIR="$HOME/.nvm"
[ -s "$(brew --prefix nvm)/nvm.sh" ] && \. "$(brew --prefix nvm)/nvm.sh"
[ -s "$(brew --prefix nvm)/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix nvm)/etc/bash_completion.d/nvm"

Reload shell:

source ~/.zshrc

Verify:

nvm -v

4) Install Node versions

List all versions:

nvm ls-remote

List LTS only:

nvm ls-remote --lts

Install latest LTS:

nvm install --lts

Install common major versions:

nvm install 18
nvm install 20
nvm install 22

Install a specific patch version:

nvm install 20.11.1

Suggested strategy:

  • Node 18 for legacy maintenance
  • Node 20 for mainstream development
  • Node 22 for newer projects

5) View and switch versions

List installed versions:

nvm ls

Temporary switch (current shell):

nvm use 18

Switch to latest LTS:

nvm use --lts

Set default:

nvm alias default 20

Check current version:

node -v
nvm current

6) Project-level auto switching

Create .nvmrc in project root:

echo "24.13.1" > .nvmrc

Then run:

nvm use

It will switch to the version declared in .nvmrc (here: 24.13.1).

For teams, commit .nvmrc to Git so everyone uses the same Node version.


7) Uninstall versions

Uninstall by major:

nvm uninstall 18

Uninstall exact version:

nvm uninstall 18.19.0

8) Apple Silicon (M4) note

nvm automatically installs darwin-arm64 binaries on Apple Silicon.

Verify architecture:

node -p process.arch

Expected:

arm64

9) Pitfalls to avoid

Do not mix package managers for Node.

If you use nvm, avoid brew install node.

Check Node path:

which node

Expected path with nvm:

~/.nvm/versions/node/v20.11.1/bin/node

If you see:

/opt/homebrew/bin/node

you likely mixed installations. Remove Homebrew Node:

brew uninstall node

10) Quick command table

PurposeCommand
List all remote versionsnvm ls-remote
List LTS versionsnvm ls-remote --lts
Install latest LTSnvm install --lts
Install specific versionnvm install 20
List installed versionsnvm ls
Switch versionnvm use 20
Set default versionnvm alias default 20
Uninstall versionnvm uninstall 18
Show current versionnode -v / nvm current

11) Full setup example

# 1) Install nvm
brew install nvm

# 2) Create nvm directory
mkdir -p ~/.nvm

# 3) Configure ~/.zshrc and reload
source ~/.zshrc

# 4) Install common versions
nvm install 18
nvm install 20
nvm install 22

# 5) Set default
nvm alias default 20

# 6) Verify
node -v
nvm ls

12) Summary

Final structure:

Mac M4
  └─ Homebrew
       └─ nvm
            ├─ Node 18 (legacy)
            ├─ Node 20 (default)
            └─ Node 22 (new projects)

This workflow keeps versions isolated, switching fast, and team setups consistent.