Last active
July 26, 2024 20:17
-
-
Save tonymtz/d75101d9bdf764c890ef to your computer and use it in GitHub Desktop.
Uninstall nodejs from OSX Yosemite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
# go to /usr/local/lib and delete any node and node_modules | |
cd /usr/local/lib | |
sudo rm -rf node* | |
# go to /usr/local/include and delete any node and node_modules directory | |
cd /usr/local/include | |
sudo rm -rf node* | |
# if you installed with brew install node, then run brew uninstall node in your terminal | |
brew uninstall node | |
# check your Home directory for any "local" or "lib" or "include" folders, and delete any "node" or "node_modules" from there | |
# go to /usr/local/bin and delete any node executable | |
cd /usr/local/bin | |
sudo rm -rf /usr/local/bin/npm | |
sudo rm -rf /usr/local/bin/node | |
ls -las | |
# you may need to do the additional instructions as well: | |
sudo rm -rf /usr/local/share/man/man1/node.1 | |
sudo rm -rf /usr/local/lib/dtrace/node.d | |
sudo rm -rf ~/.npm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing @tonymtz 👍
Very helpful trick!
But as @e2tha-e wrote (thank you too 👍)
On
macOS Big Sur version 11.2.3 (20D91
) withnodejs Latest Current Version: 15.14.0 (includes npm 7.7.6)
installed from official website, the file name is notorg.nodejs.pkg.bom
butorg.nodejs.**node**.pkg.bom
.You can check this when you
cd /var/db/receipts/ && ls -la
.So everyone, who wants to use this trick, please check the
/var/db/receipts/
directory before to make sure you write the right file name.Normally after that everything is ok.
thank you again @tonymtz & @e2tha-e
🖖