Last active
April 29, 2016 12:22
-
-
Save robinnorth/1bd2a24a7be119689dacf1f172bcdc92 to your computer and use it in GitHub Desktop.
Uninstall Node.js on OS X (from http://stackoverflow.com/a/29490456)
This file contains hidden or 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
#!/bin/bash | |
# Uninstall node.js | |
# | |
# Options: | |
# | |
# -d Actually delete files, otherwise the script just _prints_ a command to delete. | |
# -p Installation prefix. Default /usr/local | |
# -f BOM file. Default /var/db/receipts/org.nodejs.pkg.bom | |
CMD="echo sudo rm -fr" | |
BOM_FILE="/var/db/receipts/org.nodejs.pkg.bom" | |
PREFIX="/usr/local" | |
while getopts "dp:f:" arg; do | |
case $arg in | |
d) | |
CMD="sudo rm -fr" | |
;; | |
p) | |
PREFIX=$arg | |
;; | |
f) | |
BOM_FILE=$arg | |
;; | |
esac | |
done | |
lsbom -f -l -s -pf ${BOM_FILE} \ | |
| while read i; do | |
$CMD ${PREFIX}/${i} | |
done | |
$CMD ${PREFIX}/lib/node \ | |
${PREFIX}/lib/node_modules \ | |
${BOM_FILE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment