How to Uninstall Nodejs completely from Mac OSX ?

How to Uninstall Nodejs completely from Mac OSX ?

This tutorial guides you on how to uninstall Nodejs completely from Mac OSX. In our previous tutorial we have seen how to remove Nodejs from Windows. In this tutorial let’s see what steps you need to follow in order to remove Nodejs from Mac OSX.

How to Uninstall Nodejs completely from Mac OSX ?

How to Uninstall Nodejs completely from Mac OSX ?

There are couple of ways to uninstall Nodejs completely from Mac OSX. If you had installed Nodejs either by using source or using binaries then you need to delete the Node executables and other resources manually. And the other way is using Homebrew method. And finally you will also learn how to do the same using nvm.

Let’s see how to uninstall the node executable and other resource by both ways in following sections.

Manual method

To uninstall node + npm follow the below instructions one by one.

  • Delete any node and node_modules from /usr/local/lib directory.
  • Then delete any node and node_modules from /usr/local/include directory.
  • Delete node, node-debug and node-gyp from /usr/local/bin directory.
  • Delete .npmrc , .npm, .node-gyp, .node_repl_history from home directory.
  • Delete node* and npm* from /usr/local/share/man/man1 directory.
  • Delete node from /opt/local/bin , /opt/local/include and /usr/local/share/doc directories.
  • Delete node_modules from /opt/local/lib directory.
  • Delete node.stp from /usr/local/share/systemtap/tapset directory.

That’s it the above instructions are the list which include node executables and other npm resources of your Nodejs installation in Mac OSX.

Homebrew and nvm method

The Homebrew method is comparatively easier way to uninstall Nodejs from Mac OSX for brew users. Let’s assume that you have used the following command to install Nodejs on Mac.

$ brew install node

Then to remove Nodejs, simply you need to run the following brew command to uninstall the Nodejs.

$ brew uninstall node

That’s it all the references to node and npm resources on your Mac machine will be removed completely by running single command.

The Node Version Manager (NVM) is also similar to Homebrew. But you can manage multiple versions of node using nvm. Let’s say you wanted to remove all traces of specific version of Node from Mac OSX.

Simply, run the following command to remove specific version of Nodejs references from Mac.

$ nvm uninstall <version>

Note, you need to check first what are all the versions installed on your machine. Then mention the specific version in the above command.

$ nvm list

->      v6.14.4
       v14.16.0
default -> v6.14.4
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v14.16.0) (default)
stable -> 14.16 (-> v14.16.0) (default)
lts/* -> lts/fermium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.3 (-> N/A)
lts/fermium -> v14.17.3 (-> N/A)

For example,

$ nvm uninstall v6.14.4

Hope this sneppet helped 🙂

Also see:

References:

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments