Skip to content

Instantly share code, notes, and snippets.

@theand
Forked from nicerobot/README.md
Created May 29, 2016 09:56
Show Gist options
  • Select an option

  • Save theand/cabc803bcf4180d47fdff27f7b8055fe to your computer and use it in GitHub Desktop.

Select an option

Save theand/cabc803bcf4180d47fdff27f7b8055fe to your computer and use it in GitHub Desktop.

Revisions

  1. @nicerobot nicerobot revised this gist Sep 13, 2015. 1 changed file with 12 additions and 11 deletions.
    23 changes: 12 additions & 11 deletions uninstall-node.sh
    Original file line number Diff line number Diff line change
    @@ -12,21 +12,22 @@
    }
    # This will need to be executed as an Admin (maybe just use sudo).

    # Verify the bom exists, otherwise don't do anything
    [ -e /var/db/receipts/org.nodejs.pkg.bom ] || {
    echo 'Nothing to do.'
    exit 0
    }
    for bom in org.nodejs.node.pkg.bom org.nodejs.pkg.bom; do

    receipt=/var/db/receipts/${bom}
    [ -e ${receipt} ] && {
    # Loop through all the files in the bom.
    lsbom -f -l -s -pf ${receipt} \
    | while read i; do
    # Remove each file listed in the bom.
    rm -v /usr/local/${i}
    done
    }

    # Loop through all the files in the bom.
    lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
    | while read i; do
    # Remove each file listed in the bom.
    rm /usr/local/${i}
    done

    # Remove directories related to node.js.
    rm -rf /usr/local/lib/node \
    rm -vrf /usr/local/lib/node \
    /usr/local/lib/node_modules \
    /var/db/receipts/org.nodejs.*

  2. @nicerobot nicerobot revised this gist Sep 9, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    To run this, you can try:

    curl -ks https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh | bash
    curl -ks https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh | bash

    I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

    Alternatively,

    curl -ksO https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh
    curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh
    chmod +x ./uninstall-node.sh
    ./uninstall-node.sh
    rm uninstall-node.sh
  3. @nicerobot nicerobot revised this gist Jun 11, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -7,5 +7,6 @@ I haven't tested this script doing it this way but i run a lot of my Gists like
    Alternatively,

    curl -ksO https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh
    bash ./uninstall-node.sh
    chmod +x ./uninstall-node.sh
    ./uninstall-node.sh
    rm uninstall-node.sh
  4. @nicerobot nicerobot revised this gist Feb 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ To run this, you can try:

    curl -ks https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh | bash

    I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this'll work too.
    I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

    Alternatively,

  5. @nicerobot nicerobot revised this gist Feb 21, 2013. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    To run this, you can try:

    curl -ks https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh | bash

    I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this'll work too.

    Alternatively,

    curl -ksO https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh
    bash ./uninstall-node.sh
    rm uninstall-node.sh
  6. @nicerobot nicerobot revised this gist Jul 15, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion uninstall-node.sh
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@
    # This will need to be executed as an Admin (maybe just use sudo).

    # Verify the bom exists, otherwise don't do anything
    [ -d /var/db/receipts/org.nodejs.pkg.bom ] || {
    [ -e /var/db/receipts/org.nodejs.pkg.bom ] || {
    echo 'Nothing to do.'
    exit 0
    }
  7. @nicerobot nicerobot created this gist May 14, 2012.
    33 changes: 33 additions & 0 deletions uninstall-node.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    #!/bin/sh
    (( ${#} > 0 )) || {
    echo 'DISCLAIMER: USE THIS SCRIPT AT YOUR OWN RISK!'
    echo 'THE AUTHOR TAKES NO RESPONSIBILITY FOR THE RESULTS OF THIS SCRIPT.'
    echo "Disclaimer aside, this worked for the author, for what that's worth."
    echo 'Press Control-C to quit now.'
    read
    echo 'Re-running the script with sudo.'
    echo 'You may be prompted for a password.'
    sudo ${0} sudo
    exit $?
    }
    # This will need to be executed as an Admin (maybe just use sudo).

    # Verify the bom exists, otherwise don't do anything
    [ -d /var/db/receipts/org.nodejs.pkg.bom ] || {
    echo 'Nothing to do.'
    exit 0
    }

    # Loop through all the files in the bom.
    lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
    | while read i; do
    # Remove each file listed in the bom.
    rm /usr/local/${i}
    done

    # Remove directories related to node.js.
    rm -rf /usr/local/lib/node \
    /usr/local/lib/node_modules \
    /var/db/receipts/org.nodejs.*

    exit 0