How to Uninstall Node on Mac (Complete Guide)
In this article
To uninstall Node.js from your Mac, you need to remove the Node.js binary, the npm global packages, and any leftover configuration files. The exact steps depend on how you installed Node (official installer, Homebrew, or nvm). This guide covers all three methods, plus how to verify the removal.
What You'll Need
- Admin access to your Mac (you'll need to enter your password for some commands).
- A backup of any global npm packages you want to keep (optional but recommended).
- If you used nvm, you'll need to know which Node versions you have installed.
Step-by-Step
Method 1: If You Installed Node from the Official Installer (pkg)
- Open Terminal (Finder > Applications > Utilities > Terminal).
- Remove the main Node.js binary and related files by running this command:
sudo rm -rf /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/npx /usr/local/lib/node_modules
Enter your password when prompted. - Remove the npm cache and global prefix directory:
sudo rm -rf ~/.npm ~/.node-gyp - Remove the Node.js include and share directories (if they exist):
sudo rm -rf /usr/local/include/node /usr/local/share/doc/node /usr/local/share/man/man1/node.1 - Remove the uninstall script that the installer left behind (optional but tidy):
sudo rm -rf /usr/local/lib/node_modules/npm/node_modules/node-gyp - Check for any Node-related files in your home folder:
ls -la ~ | grep node
If anything appears, remove it withrm -rf(e.g.,rm -rf ~/.node_repl_history). - Verify Node and npm are gone:
node -vandnpm -vshould return "command not found".
Method 2: If You Installed Node via Homebrew
- Open Terminal.
- Uninstall Node with Homebrew:
brew uninstall node - If you had installed node with
brew install node@14or another versioned formula, use that exact name (e.g.,brew uninstall node@14). - Clean up leftover files:
brew cleanup - Remove any remaining Node files:
sudo rm -rf /usr/local/lib/node_modules ~/.npm - Verify with
node -vandnpm -v.
Method 3: If You Used nvm (Node Version Manager)
- Open Terminal.
- First, uninstall all Node versions you have installed via nvm:
nvm uninstall
Repeat for each version you have. To list them:nvm ls. - Remove the nvm directory itself:
rm -rf ~/.nvm - Edit your shell profile (e.g.,
~/.bash_profile,~/.zshrc, or~/.bashrc) and remove the lines that load nvm (they usually look likeexport NVM_DIR="$HOME/.nvm"and[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"). Use a text editor likenano ~/.zshrc. - Close and reopen Terminal, then verify with
node -vandnpm -v.
Common Mistakes
- Not removing global npm packages: If you skip removing
/usr/local/lib/node_modules, you'll leave behind packages likeyarnortypescriptthat still reference Node. - Forgetting nvm: If you used nvm and only delete the Node binary, nvm will still try to load and may reinstall Node automatically.
- Using the wrong path: On newer Macs with Apple Silicon, the Homebrew prefix is
/opt/homebrew, not/usr/local. If you used Homebrew on an M1/M2 Mac, your node binary is in/opt/homebrew/bin. - Not restarting Terminal: Your shell may cache the old path. Always open a new Terminal window after uninstalling.
Tips
- Before uninstalling, back up your global npm packages list:
npm ls -g --depth=0and save the output. You can reinstall them later withnpm install -g. - If you plan to reinstall Node later, consider using nvm to manage versions—it makes uninstalling much easier.
- After removing Node, you can also check for leftover symlinks in
/usr/local/binthat point to Node or npm:ls -la /usr/local/bin | grep node. - If you have projects that rely on Node, note that uninstalling will break them until you reinstall Node.
Troubleshooting
If Node still appears after you've followed the steps:
- Check your PATH: Run
which nodeto see where it's still found. If it shows a path like/usr/local/bin/node, you may have missed removing that file. If it shows/opt/homebrew/bin/node, you missed the Homebrew uninstall. - Check for nvm: Run
command -v nvm. If it returnsnvm, you haven't removed nvm from your shell profile. - Look for other installers: If you used a version manager like
fnmorvolta, uninstall those separately. For example,brew uninstall fnmorrm -rf ~/.volta. - Reset your shell: Run
hash -rin Terminal to clear the command cache, or close and reopen Terminal. - If all else fails: Search your entire system for node files:
sudo find / -name "node" -type f 2>/dev/null. This will show you every file named node; remove the ones that are not in system folders (like /System). Be careful not to delete system files.
Frequently Asked Questions
Will uninstalling Node delete my projects?
No. Your project files (like your app's code) are separate from Node itself. Uninstalling Node will not delete your project folders, but you won't be able to run node or npm commands until you reinstall Node.
Do I need to uninstall npm separately?
No. npm is bundled with Node, so removing Node removes npm as well. However, if you installed npm separately (rare), you'd need to remove it manually.
Can I just delete the Node folder from Applications?
No. Node.js is not installed as a typical app in the Applications folder. It's installed as command-line tools in system directories. Deleting from Applications won't work.
Will uninstalling Node affect my Homebrew installation?
No. Homebrew itself will remain. Only the node formula and its dependencies will be removed.
How do I know which method I used to install Node?
Run which node. If it shows /usr/local/bin/node, you likely used the official installer. If it shows /opt/homebrew/bin/node or /usr/local/bin/node and you have Homebrew, you used Homebrew. If it shows a path under ~/.nvm, you used nvm.
Is there a one-command uninstaller?
There is no official one-command uninstaller from Node.js. However, if you used Homebrew, brew uninstall node is the closest to a one-liner. For the official installer, you can run the script at /usr/local/lib/node_modules/npm/scripts/uninstall.sh (if it exists), but it's safer to follow the manual steps above.