Remove NodeJS from OSX

At times you can find yourself struggling with a NodeJs version conflict while trying to upgrade a newer node version or maybe you want to start using some versioning manager and want to start fresh.

To remove nodejs from OSX when it might have been installed in several different ways, such as:

  1. Install from site binaries
  2. manually
  3. from source
  4. installed using brew, macports or other version manager

when nodejs is installed, the binary is either copied to a folder that by default exists in the path or either a path was added to your bash config file (e.g. ~/.bash_config).

the defaults are:

Node.js v8.11.3 to /usr/local/bin/node

npm v5.6.0 to /usr/local/bin/npm

write in the command line

$ which node

and you will find the active nodejs version

simply delete it with rm -rf on the given path

$ rm -rf $(which node)

$ rm -rf $(which npm)

if that path is something you created manually also remove it from terminal config file e.g. ~/.bash_config

Published
Categorized as Setup