How do I uninstall nodejs installed from pkg (Mac OS X)?

前端 未结 10 1843
别那么骄傲
别那么骄傲 2020-11-30 16:32

I installed NodeJS from pkg file on my Mac. Now I need to uninstall it. Tell me please how to do it. I tried to remove files from this list:

lsbom -f

相关标签:
10条回答
  • 2020-11-30 16:56

    I ran:

    lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
    | while read i; do
      sudo rm /usr/local/${i}
    done
    sudo rm -rf /usr/local/lib/node \
         /usr/local/lib/node_modules \
         /var/db/receipts/org.nodejs.*
    

    Coded into gist 2697848

    Update It seems the receipts .bom file name may have changed so you may need to replace org.nodejs.pkg.bom with org.nodejs.node.pkg.bom in the above. The gist has been updated accordingly.

    0 讨论(0)
  • 2020-11-30 17:06

    This is the full list of commands I used (Many thanks to the posters above):

    sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
    sudo rm -rf /usr/local/include/node /Users/$USER/.npm
    sudo rm /usr/local/bin/node
    sudo rm /usr/local/share/man/man1/node.1
    brew install node
    
    0 讨论(0)
  • 2020-11-30 17:11

    I took AhrB's list, while appended three more files. Here is the full list I have used:

    sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
    sudo rm -rf /usr/local/include/node /Users/$USER/.npm
    sudo rm /usr/local/bin/node
    sudo rm /usr/local/share/man/man1/node.1
    sudo rm /usr/local/bin/npm
    sudo rm /usr/local/share/systemtap/tapset/node.stp
    sudo rm /usr/local/lib/dtrace/node.d
    # In case you want to reinstall node with HomeBrew:
    # brew install node
    
    0 讨论(0)
  • 2020-11-30 17:11

    I had to remove the following files too since brew complained in install later after manually removing all files.

    /usr/local/share/doc/node/gdbinit
    
    /usr/local/share/systemtap/tapset/node.stp
    

    and then do the following

    brew install node 
    
    brew link node
    
    0 讨论(0)
提交回复
热议问题