Skip to content

Install Node.js on macOS ​

On macOS, Homebrew is the path of least resistance.

  1. Check whether you have Homebrew. Open Terminal and run the command below. If you see a version number, it's installed:
bash
brew -v

If not, install Homebrew first:

bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Then install Node.js:
bash
brew update
brew install node
  1. Check the install:
bash
node -v
npm -v

If you see version numbers, you're done.

Option B: the official PKG installer (more visual) ​

  1. Go to the Node.js website: https://nodejs.org/
  2. Download the LTS .pkg
  3. Double-click to install
  4. Open Terminal and check:
bash
node -v
npm -v

If you see version numbers, you're done.

Troubleshooting ​

1) Permission errors on npm global installs ​

Don't force it with sudo npm -g. The cleaner fix is Homebrew's Node, or managing Node versions with nvm.

If you do hit permission errors, reinstall Node with the Homebrew method above first.

2) npm installs are slow (optional) ​

If npm downloads crawl on your network, you can switch to a mirror registry (and switch back any time):

bash
npm config set registry https://registry.npmmirror.com

Check that it took effect:

bash
npm config get registry

One base URL for GPT, Claude and Gemini