Levo guides · Uninstalling apps

How to uninstall Node.js on a Mac

How you remove Node depends on how you installed it. Run which -a node and look at the path: /usr/local/bin/node is the official installer, /opt/homebrew/bin/node is Homebrew, and a path inside ~/.nvm is nvm. Then follow the matching section below.

Levo’s popover on the Uninstall confirm step, listing an app and its leftovers with their sizes
WhatWhereSafe to delete?
Installer package/usr/local/bin/node, npm, npx, /usr/local/lib/node_modules, /usr/local/include/nodeYes
Homebrew install/opt/homebrew/Cellar/node, node@20 and so onYes, with brew uninstall
nvm versions~/.nvmYes
fnm, Volta~/.local/share/fnm, ~/.voltaYes
Global packages/usr/local/lib/node_modules or the version folderYes; list them first
npm cache~/.npmYes, rebuilt on demand
Other caches~/.node-gyp, ~/.yarn, ~/Library/pnpmYes
npm config~/.npmrcCheck for tokens before deleting
Project dependenciesnode_modules inside each projectSeparate; see the node_modules guide

How to do it yourself

First, see what you’ve got

which -a node
node -v
npm ls -g --depth=0

Note the global packages you actually use (typescript, eslint, a CLI of your own) so you can reinstall them later.

Installed with the official installer (.pkg)

The installer doesn’t come with an uninstaller. Remove what it put in /usr/local:

sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/include/node
sudo rm -f /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/npx /usr/local/bin/corepack
sudo rm -rf /usr/local/share/doc/node
sudo rm -f /usr/local/share/man/man1/node.1
sudo rm -rf /usr/local/share/systemtap/tapset/node.stp
sudo pkgutil --forget org.nodejs.node.pkg

Global CLIs installed with npm i -g leave small links in /usr/local/bin, such as tsc. List the folder and remove the links that point into node_modules:

ls -l /usr/local/bin | grep node_modules

Installed with Homebrew

brew uninstall node
brew uninstall node@20   # if you installed a versioned formula
brew autoremove

Homebrew keeps global packages in its own lib/node_modules inside the Cellar, so they go with it.

Installed with nvm, fnm or Volta

Each keeps every Node version in a folder in your home directory. Delete it and remove the setup lines from your shell file.

rm -rf ~/.nvm
rm -rf ~/.local/share/fnm
rm -rf ~/.volta

Open ~/.zshrc and ~/.zprofile and delete the lines that mention NVM_DIR, nvm.sh, fnm env or VOLTA_HOME. Open a new Terminal window and check which node returns nothing.

Caches and config

rm -rf ~/.npm ~/.node-gyp ~/.node_repl_history
rm -rf ~/.yarn ~/.cache/yarn ~/Library/pnpm ~/.pnpm-store

Open ~/.npmrc before deleting it. It may contain an auth token for a private registry, and you’ll want to revoke that on the registry’s side or keep a copy.

What stays

Your projects’ node_modules folders don’t belong to Node itself and stay put. They’re often the biggest item of all, and How to delete node_modules on a Mac covers finding and removing them. For the cache alone, see How to clear the npm cache.

How Levo does it

Levo’s Ready to free list groups package caches, including npm’s, and old node_modules folders with sizes and reasons. Your agent judges which are stale; you tick what goes. That frees most of the space Node leaves behind without removing Node itself.

Node installed from the official .pkg isn’t an app in /Applications, so there’s no Uninstall entry for it. The commands above are the way, and they need your administrator password. Where Node came with an app (for example a desktop app that bundles it), ⌘K and “uninstall” followed by its name handle the app and its leftovers. See Levo for web developers and Uninstall apps and their leftovers. Uninstalls go to the Trash, and Put back in ⌘K restores the app with its leftovers for a day.

FAQ

How do I know how Node was installed?

Run which -a node. A path under /usr/local/bin usually means the official installer, /opt/homebrew/bin means Homebrew, and a path inside ~/.nvm, ~/.volta or fnm’s folder means that version manager.

Does the official Node installer have an uninstaller?

No. You remove the files it installed into /usr/local by hand, as listed above, then run pkgutil --forget to drop the receipt.

Will uninstalling Node delete my projects?

No. Projects live in your own folders. Their node_modules folders stay too, and you can delete those separately.

What are global npm packages and where do they go?

Packages installed with npm i -g. They live in the Node install’s lib/node_modules folder, so they’re removed with Node. List them with npm ls -g --depth=0 first if you want to reinstall any.