If you want to uninstall Node.js from Mac in the simplest manner, you’ve come to the right place. Irrespective of whether you installed Node using Homebrew, a package manager, nvm, or compiled from scratch, this tutorial has you covered. Occasionally, Node.js upgrades fail. Perhaps you’re changing tools.
This tutorial will demonstrate how to uninstall Node.js on Mac in a straightforward, simple, and comprehensive manner. We will verify your installation type, remove all residual files, delete global packages, and check that everything’s removed.
Find Out How Node.js Was Installed
Before removing Node.js, it’s important to understand how it was installed on your Mac. This step decides which method you should use for uninstalling. Most people use one of four methods. These are Homebrew, the official macOS installer, Node Version Manager (nvm), or compiling from source.
To figure it out, open the Terminal and type the command: which node. If the path shown is /opt/homebrew/bin/node or /usr/local/bin/node, then it’s likely from Homebrew or the installer. If you use nvm, try running nvm ls. This tells you if you’re using the version manager and what versions are installed.
Read More About : What Version of Node.js Should I Use in 2025? (LTS vs Current Explained Simply)
Confirm Node.js and npm Versions
Before you delete anything, confirm that Node.js is active and running. Open the Terminal and type node -v. Then type npm -v. If both return version numbers, Node and npm are installed. If they don’t, either Node is missing or your path is broken.
You should also check where the programs are located. Run which node and which npm. These commands show you the exact file paths. They will be useful when you begin deleting files manually later in the process. This step helps avoid removing the wrong files.
Remove Node.js Installed via Homebrew
If you used Homebrew to install Node.js, removing it is simple and clean. First, open your Terminal and run the command brew uninstall node. This will remove Node.js from your system. After that, type brew cleanup. This clears any leftover cache or temporary files.
There’s one more thing to check. Some files might still exist in folders like /usr/local/bin or /opt/homebrew/bin. Use the ls command to check for leftover files like node or npm. If you see them, use the rm command to remove them. This ensures Node.js is fully gone from your system.
Remove Installer-Based Node.js Manually
If you installed Node.js using the official installer from the Node.js website, you will have to do a manual uninstall. First, delete the main binaries. These are usually located in /usr/local/bin. Use sudo rm /usr/local/bin/node and sudo rm /usr/local/bin/npm. This deletes the main commands.
Next, remove the folders that store Node.js files. These include /usr/local/lib/node_modules, /usr/local/include/node, and /usr/local/share/doc/node. These folders hold packages, headers, and docs. Use sudo rm -rf followed by the folder path. Finally, open your shell file like .
Uninstall Node.js Using nvm (Node Version Manager)
If you’re using nvm, removing Node.js is very easy. Start by typing nvm ls in your Terminal. This shows all the installed versions. To remove one, use nvm uninstall followed by the version number. For example, type nvm uninstall 18 if that’s the version you want to remove.
If you want to remove nvm itself, you need to delete the .nvm folder in your home directory. Type rm -rf ~/.nvm. Then open your shell config file like .zshrc or .bash_profile. Remove any lines that include nvm. Save the file and type source ~/.zshrc to apply the changes.
Remove Source-Built Node.js
Some users install Node.js by compiling it from source. This is more advanced, but also easy to remove if you follow the right steps. If you still have the source folder, navigate to it in Terminal and type sudo make uninstall. This command removes all installed files.
If you no longer have the source files, you will need to delete the folders manually. These include /usr/local/bin/node, /usr/local/lib/node_modules, and /usr/local/include/node. Use the rm -rf command carefully. Make sure you’re only deleting Node-related files.
Delete Global npm Packages and Cache
Even after Node.js is removed, npm often leaves global packages and cache files behind. These can take up space and cause problems if you reinstall later. To remove them, type rm -rf /usr/local/lib/node_modules in your Terminal.
Then clear the npm cache by typing npm cache clean –force. You should also remove the .npm folder from your user directory. Type rm -rf ~/.npm. These steps make sure your system is clean and ready for any future installation of Node.js.
You Will Like : What Raspberry Pi Should I Buy? Your 2025 Guide to Every Model and Use Case
Clean Your Shell Configuration Files
Sometimes Node.js adds lines to your shell configuration file. These lines control how the terminal finds programs like node and npm. You should clean these out after uninstalling. Open your Terminal and type nano ~/.zshrc or nano ~/.bash_profile, depending on your shell.
Look for any lines that include node, npm, or nvm. Delete them. Then save the file and type source ~/.zshrc or source ~/.bash_profile to apply the changes. This final step removes any remaining links to Node.js from your terminal setup.
Extra detail for Section 1: Find Out How Node.js Was Installed
Knowing how Node.js got onto your Mac is like tracing a car’s engine to figure out how to fix it. Different installation methods leave different footprints. For example, Homebrew puts things in one set of folders while the Node.js installer uses another. Tools like nvm hide everything in your home folder.
To figure it out more deeply, run the command ls -l $(which node). This will show if the file is a symlink and where it points. If it points to somewhere inside /opt/homebrew or /usr/local/Cellar, it’s Homebrew. If it shows a version inside ~/.nvm, you’re using nvm.
Extra detail for Section 2: Confirm Node.js and npm Versions
Checking the versions isn’t just about seeing numbers. It tells you whether Node.js is even working right now. Sometimes you think it’s installed, but a broken path or missing symlink can make the terminal act like it’s gone. That’s why version commands matter. They tell you the truth.
You can also use the command echo $PATH to see all the locations your terminal checks for programs. This can reveal if node or npm was manually added to the path. If so, that might explain why Node seems to “come back” after uninstalling.
Expanded Table: Node Installation Type vs. Removal Method
This table helps you match your install type with the correct uninstall strategy, saving you from errors or leftover files.
Installation Method | How to Detect It | How to Remove It | Difficulty |
Homebrew | which node shows /opt/homebrew | brew uninstall node | Easy |
Installer (.pkg) | /usr/local/bin/node exists | Manually delete files | Medium |
nvm | nvm ls shows versions | nvm uninstall <version> | Easy |
Source Build | Compiled manually using make | make uninstall or delete | Advanced |
Extra detail for Section 4: Remove Installer-Based Node.js
The .pkg installer is like pouring cement—it spreads files across your system. That’s why removing them manually is tricky. If you miss one folder, you may find npm still working months later. To be thorough, also check /usr/local/share/systemtap/tapset. Some Node installers drop tracing files there. Not removing them can leave unnecessary system clutter.
Don’t forget to check hidden folders too. Use the command ls -a to view them. Some folders like ~/.node_repl_history and ~/.npmrc are hidden by default but might contain Node history and config settings. They’re small but worth removing for a complete uninstall.
FAQ”s
What is the safest way to uninstall Node.js on Mac?
The safest way is to first find out how it was installed, then use the matching uninstall method. This avoids deleting important files by mistake.
Is deleting nodes from /usr/local/bin enough?
No. That only removes one part. You must also delete libraries, include files, and npm packages to fully uninstall Node.js.
Can I reinstall Node.js after uninstalling it?
Yes, you can reinstall anytime. Just make sure all old files are removed first to avoid version conflicts.
How do I know if I used nvm to install Node?
Run the command nvm ls. If it shows versions, you use nvm. If not, you probably used Homebrew or the installer.
What happens if I skip npm cache cleanup?
Old cache files might cause errors in future installs. Always clean the npm cache after uninstalling Node.js.
Conclusion
Now you know how to uninstall Node.js on Mac using the correct method for your setup. Whether you installed it with Homebrew, an installer, nvm, or from source, each path is covered. You’ve also learned how to clean global packages, npm cache, and shell settings. These steps help you avoid leftover files that can slow down your system or create future conflicts. A clean removal ensures you can reinstall later without trouble. Follow each step carefully, and your Mac will stay clean, organized, and ready for new development tools.