Node.js is a JavaScript runtime environment and an open-source tool. It helps execute code of the JavaScript programming language outside a specific web browser. However, if it clogs up your system and slows it down, you may want to uninstall Node on Mac.

Fortunately, if you have no idea how to uninstall an application on a Mac without leftovers, you’re in the right place. We will guide you on how to uninstall and install Node on Mac easily.

Contents: Part 1. How Do I Uninstall Node on A Mac Manually?Part 2. How Do I Delete A Specific Node or All Notes on Mac?Part 3. How to Install Node on Mac?Part 4. Conclusion

Part 1. How Do I Uninstall Node on A Mac Manually?

So, how to remove the Node app? This will not be an easy process if you’re doing it manually.

The first thing you should do is to remove the older versions of the app on your computer. If you have installed the Node app on your computer using Homebrew, the installation process will be easy.

#1. Uninstall Node on Mac Using Terminal Commands

Another thing you can do to uninstall Node on Mac is to run a command within your Mac’s Terminal. Here’s the command you can run:

sudo rm -rf ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.node_repl_history
sudo rm -rf /usr/local/include/node
sudo rm -rf /usr/local/include/node_modules

sudo rm -rf /usr/local/bin/npm /usr/local/bin/node-debug
sudo rm -rf /usr/local/bin/node /usr/local/bin/node-gyp
sudo rm -rf /usr/local/share/man/man1/node*
sudo rm -rf /usr/local/share/man/man1/npm*

sudo rm -rf /opt/local/include/node
sudo rm -rf /opt/local/bin/node
sudo rm -rf /opt/local/lib/node

sudo rm -rf /usr/local/share/doc/node
sudo rm -rf /usr/local/share/systemtap/tapset/node.stp
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d

brew uninstall node
brew cleanup --prune-prefix

In fact, these Terminal commands show the same paths as the method 2 list in "Uninstall Node on Mac without Homebrew" in this article, so you can refer to those paths to creat command lines. For example:

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

After that, you have to delete every global package you have installed using your NPM. To do this, run the following command on your Terminal: “rm –rf ~/.npm”. Once you have typed the command found within the quotes, you will have completed the task of uninstalling Node on Mac uninstalling NPM.

#2. How to Uninstall Node on Mac Using Homebrew?

The most used method to uninstall Node on Mac and delete npm is using Homebrew command (more suitable for the users that got and installed the Node.js from Homebrew):

  1. Type in “brew uninstall --force node”. Once you have executed this command, Homebrew will now uninstall all versions of Node within your computer (You need to run brew with this "--force" flag to make sure all versions of Node can be deleted).
  2. After that, you can type in: “brew cleanup” to remove folders and dependencies that are unused.

#3. How to Uninstall Node on Mac without Homebrew?

But what if you didn’t use Homebrew to install Node? How do you uninstall Node without Homebrew?

Here are the steps to uninstall Node on Mac manually if you get the Node by the binary distribution or by source.

  1. Delete Node Manually. First, you have to delete Node manually and move it to Trash.
  2. Launch Finder and Terminal.
    (You can try the which command to find Node files, like $ which node
    /Users/your name/.nvm/versions/node/your version of node/bin/node)
  3. Delete folders of NPM and Node.js. Now, you have to delete the executable and other npm resources which can usually be found on the following paths:
  • NODE_MODULES or NODE located in /usr/local/library or /usr/local/lib
  • NODE-GYP located within /usr/local/bin
  • NODE located within /usr/local/bin
  • NODE-DEBUG located within /usr/local/bin
  • NODE located in /usr/local/include
  • NODE_MODULES located in /usr/local/include
  • NPM located in your home directory
  • NODE-GYP located within your main home directory
  • NODE located in /opt/local/include
  • NODE from /opt/local/bin/
  • NODE in /usr/local/share/doc
  • NODE_MODULES located in /opt/local/lib/
  • NODE_REPL_HISTORY in your main home directory
  • Node.stp located within /usr/local/share/systemtap/tapset/
  • Node.d located in /usr/local/lib/dtrace/
  • NPM* located in /usr/local/share/man/man1
  • NODE* located in/usr/local/share/man/man1
  • .NPMRC from your main directory. This should not be deleted if you want to reinstall Node.js immediately after an uninstallation.
  1. Empty Trash. The last thing you should do is to empty the Trash in your macOS.

Uninstall Node on Mac

Part 2. How Do I Delete A Specific Node or All Notes on Mac?

So, what’s the easiest way if you want to uninstall a specific version or all the versions of Node from Mac? Of course, it’s the automatic way of doing so with PowerMyMac and its App Uninstaller module.

PowerMyMac is a cleanup and optimization tool used within macOS. It helps to remove unnecessary files within your system, making it clog-free. Plus, it has an app uninstaller module to help you remove apps without leaving trace files. And you can choose which version to delete.

Get A Free Trial Now!

Here are the steps to use PowerMyMac:

  1. Download, install, and open the tool.
  2. Press App Uninstaller and then click SCAN.
  3. Locate Node app in the results that are shown.
  4. Now, click the Node.js app taht you want to remove.
  5. Press the CLEAN button.
  6. Wait for the process to be complete.

Uninstall Node on Mac Automatically

Part 3. How to Install Node on Mac?

After knowing how we can uninstall Node on Mac, we will teach you how to install it so you can re-install the app easily.

One example that’s great for a streamlined web development process is Gulp.js. Another thing you can use to install Node properly (without uninstalling Node.js due to a faulty installation process) is Homebrew.

So, here are the steps to follow to install Node.js within macOS Catalina, Big Sure (and former versions of the Mac OS X):

  1. Go to the official website of Node.js (http://nodejs.org) and then download its latest package. There are different versions of the runtime environment. It is suggested that you go for the LTS version if you’re just starting.
  2. Open the . DMG file and follow the prompts on the screen to install the NPM and the Node. The Node Package Manager will enable you to install different packages for the runtime environment Node.js.
  3. Type in “echo $PATH” within the Terminal to check if there’s a path known as “/usr/local/bin” within your computer after installation.
  4. If the path is not present on your computer, you can add it to your home directory in.ZSHRC.
  5. Check if the installation is done properly by typing the code below within your command line node to launch a session of node JavaScript. The code is as follows:

node
> console.log(‘hello node’);
hello node
undefined
>

  1. Press CTRL + C about two times to exit the session within Node.js.

So, how do you check the version of Node within your Mac computer? To do this, type in “node -v”. How about updating it? You can simply download and then install the newer version of the Node from the official website of Nodejs.org. This will enable you to override the lower version. Plus, it will still keep packages that have been previously installed.

Part 4. Conclusion

We have given you the top ways to uninstall Node on Mac. We also gave you ways on how to install it if you want to. The best way to uninstall Node from Mac is not through the manual way.

Uninstall Node on Mac Easily!

The best method is through PowerMyMac because it ensures that no leftover files will be kept within your system. Thus, you’re doing a complete cleanup and uninstall Node process to help you remove the clog within your system. Finally, this will also help you save more space within your Mac for more important files.