Skip to content

Instantly share code, notes, and snippets.

@bradwestfall
Last active January 23, 2022 17:33
Show Gist options
  • Star 24 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bradwestfall/2ca354323e30924c9099 to your computer and use it in GitHub Desktop.
Save bradwestfall/2ca354323e30924c9099 to your computer and use it in GitHub Desktop.
sudo npm uninstall npm -g
brew uninstall node

Then

sudo rm -rf /usr/local/lib/dtrace/node.d /usr/local/lib/node_modules /usr/local/bin/npm /usr/local/bin/nodemon /usr/local/bin/node /usr/local/include/node ~/.npm* ~/.node* /usr/local/share/man/*/node* /usr/local/share/man/*/npm*

Which removes the following

  • /usr/local/lib/dtrace/node.d
  • /usr/local/lib/node_modules
  • /usr/local/bin/npm
  • /usr/local/bin/nodemon
  • /usr/local/bin/node
  • /usr/local/include/node
  • ~/.npm*
  • ~/.node*
  • /usr/local/share/man/*/node*
  • /usr/local/share/man/*/npm*
@gmerabishvili
Copy link

Can't uninstall node on mac to reinstall the stable version. Can you help me?

@gmerabishvili
Copy link

This command doesn't work : (

@bradwestfall
Copy link
Author

I just saved this (along with some of my other public gists) as notes to me. This worked for me with a Mac version a few years ago. Sorry it's not working now. I think I got this information by going around to lots of websites and kind of "averaging" all their best ideas. You might have to do something like that again for modern Mac

@gmerabishvili
Copy link

@bradwestfall I finally managed to uninstall node on mac. Thank you!

@derplak
Copy link

derplak commented Jun 5, 2020

Hi everyone here, I´ve had this same problem, searched a lot in Stack Overflow and Node.JS docs to fix this without make it, but today (while researched a bit more) founded this, is a "non code" solution but worked amazingly well and was much safer than running commands with exotic flags:

Deleting Node.JS from Mac computer

Hope this works to you too, that guy saved my day for sure!
(I´m on High Sierra)

@riderrocks
Copy link

Hi everyone here, I´ve had this same problem, searched a lot in Stack Overflow and Node.JS docs to fix this without make it, but today (while researched a bit more) founded this, is a "non code" solution but worked amazingly well and was much safer than running commands with exotic flags:

Deleting Node.JS from Mac computer

Hope this works to you too, that guy saved my day for sure!
(I´m on High Sierra)

Thanks for sharing. It worked!

@derplak
Copy link

derplak commented Apr 26, 2021

Hi everyone here, I´ve had this same problem, searched a lot in Stack Overflow and Node.JS docs to fix this without make it, but today (while researched a bit more) founded this, is a "non code" solution but worked amazingly well and was much safer than running commands with exotic flags:
Deleting Node.JS from Mac computer
Hope this works to you too, that guy saved my day for sure!
(I´m on High Sierra)

Thanks for sharing. It worked!

Glad to read that brother, I´m planning to realease a front/back end public wiki with troubleshooting, if you are interested I´ll be posting the link in my GitHub profile 😉

@lerocha
Copy link

lerocha commented Jun 29, 2021

Thanks for this script! It worked for me to uninstall node 14.17.1 from my mac! I only needed to exclude /usr/local/bin/nodemon from the list since this directory doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment