Sweepfor Mac

Apps & uninstalling

How to Completely Uninstall Node.js From Your Mac

Remove Node.js from your Mac whether installed via the official installer, Homebrew, nvm, or Volta — including npm caches and global packages.

8 min read

Node.js on a Mac is a moving target because there’s no single “right” way to install it. You might have Node installed via:

  1. The official .pkg installer from nodejs.org
  2. Homebrew (brew install node)
  3. nvm (the Node Version Manager)
  4. fnm (a faster nvm alternative)
  5. volta
  6. asdf with the nodejs plugin
  7. The Node version bundled with another tool (Electron apps, Docker)

Each puts files in different places. To completely uninstall Node, you need to know which one(s) you have. Here’s how to find out and remove all of them on macOS Sonoma 14 and Sequoia 15.

Identify which Node installation(s) you have

Run these in Terminal:

which -a node

This shows every node binary in your PATH. Common results:

  • /usr/local/bin/node → official installer or Intel Homebrew
  • /opt/homebrew/bin/node → Apple Silicon Homebrew
  • /Users/<you>/.nvm/versions/node/v20.x.x/bin/node → nvm
  • /Users/<you>/.volta/bin/node → Volta
  • /Users/<you>/.fnm/node-versions/v20.x.x/installation/bin/node → fnm
  • /Users/<you>/.asdf/installs/nodejs/20.x.x/bin/node → asdf

You might have multiple — for example, both Homebrew Node and nvm-managed Node, with PATH ordering deciding which one wins. To uninstall completely, remove every variant.

node --version
npm --version

These tell you which Node the shell is currently using. Useful but not the whole picture.

Tip: Before uninstalling, dump the list of globally installed npm packages so you can restore them if needed: npm list -g --depth=0 > ~/Desktop/npm-globals.txt. Some packages (yarn, pnpm, typescript, eslint, prettier) are common candidates worth tracking even if you nuke everything else.

Uninstall the official .pkg installer version

If you installed Node from the .pkg file at nodejs.org, removal is trickier because macOS doesn’t track .pkg installations as discrete units (no “Apple-pkg-installer-uninstaller” exists).

The official Node docs have a removal script. Run these as a sequence:

sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/include/node
sudo rm -rf /usr/local/include/node_modules
sudo rm -f /usr/local/bin/node
sudo rm -f /usr/local/bin/npm
sudo rm -f /usr/local/bin/npx
sudo rm -f /usr/local/bin/corepack
sudo rm -f /usr/local/share/man/man1/node.1
sudo rm -f /usr/local/share/man/man1/npm*.1
sudo rm -f /usr/local/share/man/man1/npx.1
sudo rm -rf /usr/local/share/doc/node
sudo rm -rf /usr/local/share/systemtap
sudo rm -rf /usr/local/lib/dtrace/node.d
sudo rm -rf /var/db/receipts/org.nodejs.*

Enter your admin password when prompted. The last line removes the pkg install receipts so macOS doesn’t think Node is still installed.

Uninstall Homebrew Node

If Node came from Homebrew:

brew uninstall node
brew uninstall --ignore-dependencies node-gyp 2>/dev/null
brew cleanup --prune=all

This removes the Node bundle from /opt/homebrew/Cellar/node/ (or /usr/local/Cellar/node/ on Intel) and unlinks the binaries. Homebrew is good at clean uninstalls; nothing meaningful is left after this.

If you have a versioned Homebrew Node like node@20, replace node with the versioned name.

Uninstall nvm

nvm is the most popular Node version manager. To remove:

rm -rf ~/.nvm

This wipes nvm entirely, including every Node version you’d installed through it (often 5+ GB if you have a few versions sitting around).

Then clean up your shell profile. Open ~/.zshrc (or ~/.bash_profile) and remove these lines:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

Save, open a new terminal session, run nvm --version to confirm it’s gone.

Uninstall Volta

rm -rf ~/.volta

Then remove from your shell profile:

export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"

Volta also has files in ~/Library/Application Support/Volta/ on some installs — remove that too:

rm -rf ~/Library/Application\ Support/Volta

Uninstall fnm

If installed via Homebrew: brew uninstall fnm. Otherwise:

rm -rf ~/.fnm
rm -rf ~/Library/Application\ Support/fnm

Remove eval "$(fnm env)" lines from your shell profile.

Skip the manual huntSweep finds every leftover preference, cache, and support file in seconds. Download Sweep free →

Uninstall asdf nodejs plugin

If you used asdf:

asdf plugin remove nodejs

This removes all Node versions installed via asdf. To remove asdf itself, see asdf’s docs — but if you only want to remove the Node piece, the plugin removal above is enough.

npm cache and config

npm’s global cache and per-user config:

  • ~/.npm/ — global cache (often hundreds of MB)
  • ~/.npmrc — npm config file
  • ~/.npm-global/ — global installs (if you’d configured this as your prefix)

Remove all:

rm -rf ~/.npm
rm -f ~/.npmrc
rm -rf ~/.npm-global

The ~/.npm/ cache is one of those folders that quietly grows over years. I’ve seen 4 GB on Macs that have been doing JS dev for a while.

Yarn cache and config

If you ever installed Yarn (often globally via npm install -g yarn, sometimes via Homebrew):

rm -rf ~/.yarn
rm -rf ~/.config/yarn
rm -f ~/.yarnrc
rm -f ~/.yarnrc.yml

For Yarn Berry (v2+), there’s also:

rm -rf ~/Library/Caches/Yarn

pnpm cache and config

If you used pnpm:

rm -rf ~/.pnpm-store
rm -rf ~/Library/pnpm
rm -rf ~/.local/share/pnpm
rm -f ~/.npmrc.pnpm

pnpm’s content-addressable store can be huge — 5+ GB is normal for someone using it heavily across many projects.

Per-project node_modules

This is the part most uninstall guides miss. Every Node project you’ve ever worked on has a node_modules/ folder, and these can be enormous (typical React project: 200–500 MB; TypeScript monorepo: several GB).

To find them all:

find ~ -name "node_modules" -type d -prune 2>/dev/null

This lists every node_modules/ in your home folder. Whether to delete them is a judgment call — they’ll regenerate with npm install when you next work on each project, so deleting is non-destructive but means a slow first build for each project.

If you’re truly done with Node dev:

find ~ -name "node_modules" -type d -prune -exec rm -rf {} + 2>/dev/null

This removes every node_modules/ folder. Be careful — this is irreversible (well, for the time it takes to npm install again).

Don’t dig through ~/Library yourselfSweep hunts down every leftover an uninstaller misses. Free download for Mac →

Verify everything’s gone

which -a node npm npx yarn pnpm
node --version 2>&1
ls ~/.nvm ~/.volta ~/.fnm ~/.npm 2>&1

The first command should return nothing. The version commands should fail. The folders should not exist.

If anything still shows up, check your shell profile for stale PATH entries — sometimes a leftover export PATH=...node... keeps an absent binary “findable.”

Manual vs. Sweep

Node is one of the more sprawling uninstalls because it spans the system level (/usr/local/), shell tooling (~/.nvm, ~/.volta), npm caches (~/.npm/), Yarn/pnpm equivalents, and per-project node_modules/ folders scattered across your filesystem.

Sweep targets the user-level Library and home-folder paths (~/.npm/, ~/.nvm/, ~/.volta/, ~/.yarn/, etc.) in one pass. The system-level .pkg install removal is still manual via Terminal because it requires admin and surgical file removal. The per-project node_modules/ folders are also a separate scan — Sweep can find and clean those if you point it at your projects directory.

Reinstalling Node cleanly

If you reinstall Node, my recommendation is a version manager — nvm, fnm, or Volta. They make switching versions per-project trivial and avoid the system-level mess of the .pkg installer.

For a fresh nvm install:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Then nvm install --lts for the latest LTS. If you saved your global packages list earlier, restore them with:

xargs npm install -g < ~/Desktop/npm-globals.txt

That’s Node, npm, every version manager, and the per-project mess fully cleaned up. Your disk just got a few gigabytes lighter, and your Mac is one runtime cleaner.

← Back to all guides