Skip to content

Instantly share code, notes, and snippets.

@bradwestfall
Last active January 23, 2022 17:33
Show Gist options
  • 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*
@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