Skip to content

How to uninstall Node.js on a Mac, when you have more than one

Node from the installer, Homebrew and nvm each come out differently. On our Mac there were three at once, 2.2 GB of global packages and a 6.3 GB cache.

7 min read

How do I completely uninstall Node.js on a Mac?

Run which -a node to see every copy, then remove each one the way it was installed. On our Mac the answer was three: /usr/local/bin/node from the Node.js installer, /opt/homebrew/bin/node from Homebrew, and eight versions under ~/.nvm.

Came fromPathHow to remove
Node.js installer (.pkg)/usr/local/bin/nodeThe steps below
Homebrew/opt/homebrew/bin/nodebrew uninstall node
nvm~/.nvm/versions/node/nvm uninstall 18.12.0 for each, or remove nvm itself
Volta, fnm, asdftheir own folderstheir own uninstall command

How do I uninstall Node installed with the .pkg installer?

Move these to the Trash, then tell macOS to forget the installer's receipt. The installer put files in four places under /usr/local:

  1. /usr/local/bin/node, and the npm, npx and corepack links next to it
  2. /usr/local/lib/node_modules: npm itself and every package you installed with npm install -g
  3. /usr/local/include/node (53 MB here)
  4. /usr/local/share/man/man1/node.1 and /usr/local/share/doc/node
sudo pkgutil --forget org.nodejs.node.pkg
sudo pkgutil --forget org.nodejs.npm.pkg

Do not rely on the receipt to list the files. On our Mac, pkgutil --pkg-info org.nodejs.node.pkg recorded version 20.14.0, while /usr/local/bin/node -v answered 22.14.0: a later install had replaced the files without the record matching. Check the four places by hand.

What about global npm packages and the npm cache?

They are usually bigger than Node itself. Our global packages in /usr/local/lib/node_modules were 2.2 GB, six of them over 140 MB each, and the npm cache in ~/.npm was 6.3 GB. Node itself was under 100 MB. Before removing Node, run npm ls -g --depth=0 and note the packages you will want back. The cache in ~/.npm is safe to move to the Trash whether you keep Node or not.

How do I remove nvm and every Node version it installed?

Move ~/.nvm to the Trash, then delete the lines nvm added to your shell file (~/.zshrc on a current Mac) and open a new Terminal window. Ours held eight versions and 4.5 GB. To keep nvm and clear old versions instead, see removing old Node versions.

How do I check Node is gone?

Open a new Terminal window and run which -a node. No output means every copy is gone. A path means one is left, and the path says which.

Projects are a separate pile: each keeps its own node_modules. See why node_modules takes so much space.

Common questions

How do I find out how Node was installed on my Mac?

Run which -a node. /usr/local/bin is the Node.js installer, /opt/homebrew/bin is Homebrew, and a path in ~/.nvm is nvm.

Does uninstalling Node remove global npm packages?

For the installer version, they are in /usr/local/lib/node_modules and go when you remove that folder. List them first with npm ls -g --depth=0.

Is it safe to delete the .npm folder on Mac?

Yes. ~/.npm is npm's download cache. npm downloads again what it needs. It was 6.3 GB on our Mac.

Read next