Instantly share code, notes, and snippets.

Embed
What would you like to do?
Uninstall nodejs from OSX Yosemite
# 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
@tristankirkpatrick

This comment has been minimized.

Copy link

tristankirkpatrick commented Jun 13, 2015

Thanks - this worked a treat.

@carmelyne

This comment has been minimized.

Copy link

carmelyne commented Jun 17, 2015

Thanks. Its a very helpful guide.

@emrais

This comment has been minimized.

Copy link

emrais commented Jun 27, 2015

I've been looking for something like this. Many thanks.

@stevenchanin

This comment has been minimized.

Copy link

stevenchanin commented Jul 2, 2015

Thanks very much for making the time to post these

@hamdiceylan

This comment has been minimized.

Copy link

hamdiceylan commented Jul 2, 2015

I've been looking like this commands. Thank you

@jumpinjan

This comment has been minimized.

Copy link

jumpinjan commented Jul 6, 2015

Thank you! very helpful

@maxarouca

This comment has been minimized.

Copy link

maxarouca commented Jul 22, 2015

Great Job. Thank you!

@mpepping

This comment has been minimized.

Copy link

mpepping commented Jul 25, 2015

Great help .. thnx!

@lclghst

This comment has been minimized.

Copy link

lclghst commented Jul 30, 2015

Thanks Tony ๐Ÿ‘

@sethwklein

This comment has been minimized.

Copy link

sethwklein commented Jul 31, 2015

Before uninstalling node, consider using npm to uninstall everything installed that way.

@Tokuriku

This comment has been minimized.

Copy link

Tokuriku commented Aug 1, 2015

Awesome stuff!

@idautocfator

This comment has been minimized.

Copy link

idautocfator commented Aug 4, 2015

Strange that its so complicated to uninstall node.

@skapil

This comment has been minimized.

Copy link

skapil commented Aug 5, 2015

Thanks for writing this.

@jfmercer

This comment has been minimized.

Copy link

jfmercer commented Aug 11, 2015

๐Ÿ‘ Great work, and thank you for sharing.

@theednaffattack

This comment has been minimized.

Copy link

theednaffattack commented Aug 17, 2015

Dope, dude. Thank you.

@paulkore

This comment has been minimized.

Copy link

paulkore commented Aug 24, 2015

Awesome! Thanks a bunch! ๐Ÿ‘

@scottdavidcraig

This comment has been minimized.

Copy link

scottdavidcraig commented Sep 3, 2015

Hero

@jsonCummings

This comment has been minimized.

Copy link

jsonCummings commented Sep 6, 2015

Still getting after everything:
Warning: node-0.12.7_1 already installed, it's just not linked

@jduffy3

This comment has been minimized.

Copy link

jduffy3 commented Sep 7, 2015

I also removed the following on my version of node-js
sudo rm -rf ~/.node-gyp/

@yogieputra8

This comment has been minimized.

Copy link

yogieputra8 commented Sep 8, 2015

@jsonCummings, +1
get the same error message here:

Yogies-MacBook-Pro:bin yogieputra$ node --version
v0.12.7
Yogies-MacBook-Pro:bin yogieputra$ npm --version
-bash: /usr/local/bin/npm: No such file or directory
Yogies-MacBook-Pro:bin yogieputra$ brew install npm
Warning: node-0.12.7_1 already installed, it's just not linked
@nick2474

This comment has been minimized.

Copy link

nick2474 commented Sep 10, 2015

Great its help me alot

@alexpts

This comment has been minimized.

Copy link

alexpts commented Sep 11, 2015

Thank you

@ankurarora

This comment has been minimized.

Copy link

ankurarora commented Sep 12, 2015

great...worked like charm

@e2tha-e

This comment has been minimized.

Copy link

e2tha-e commented Sep 12, 2015

@tonymtz On my installation of Node v4.0.0 on Yosemite 10.10.5, the first line needed to be
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
A different filename from org.nodejs.pkg.bom
Otherwise, this worked like a charm!

@lawrenceleach

This comment has been minimized.

Copy link

lawrenceleach commented Sep 13, 2015

Thank you for this.

@michahell

This comment has been minimized.

Copy link

michahell commented Sep 16, 2015

Can't believe that this is still the way to uninstall node. barbaric really

@MarCB720

This comment has been minimized.

Copy link

MarCB720 commented Sep 17, 2015

You're awesome, thanks. I agree with Michahell. Removing node is barbaric and savage!

@KloseD

This comment has been minimized.

Copy link

KloseD commented Sep 24, 2015

Thanks a lot! :)

@contrerasmarc

This comment has been minimized.

Copy link

contrerasmarc commented Sep 25, 2015

Muchas gracias!

@AndrewCull

This comment has been minimized.

Copy link

AndrewCull commented Sep 26, 2015

Thank you very much, worked great!

@leonardteo

This comment has been minimized.

Copy link

leonardteo commented Sep 28, 2015

Thank you so much!!

@josvaler

This comment has been minimized.

Copy link

josvaler commented Sep 29, 2015

Excelent script. Thank you

@adamatti

This comment has been minimized.

Copy link

adamatti commented Oct 1, 2015

It saved me today. Thanks!

@javedlalani

This comment has been minimized.

Copy link

javedlalani commented Oct 2, 2015

Nice work!

@PeacheyA

This comment has been minimized.

Copy link

PeacheyA commented Oct 12, 2015

Perfect, exactly what I've been searching for.
Had some rogue unlinked files from broken hombrew updates. Now all resolved. Hero.

I found this tutorial very helpful also. https://gist.github.com/DanHerbert/9520689

@lisacheng

This comment has been minimized.

Copy link

lisacheng commented Oct 21, 2015

thank you for sharing this

@SteveZhangBit

This comment has been minimized.

Copy link

SteveZhangBit commented Oct 27, 2015

Thanks! It works well!

@red2678

This comment has been minimized.

Copy link

red2678 commented Nov 8, 2015

Worked ty

@jungcollin

This comment has been minimized.

Copy link

jungcollin commented Nov 17, 2015

Thanks

@joellongie

This comment has been minimized.

Copy link

joellongie commented Dec 1, 2015

Really worked great for me, cleaned everything up nicely. Thanks

@roblav96

This comment has been minimized.

Copy link

roblav96 commented Dec 2, 2015

looking good!!!

@darkajax

This comment has been minimized.

Copy link

darkajax commented Dec 2, 2015

gracias Tony, muy รบtil!

@candidodmv

This comment has been minimized.

Copy link

candidodmv commented Dec 3, 2015

Thanks so much! Very useful tips.

@mkokay

This comment has been minimized.

Copy link

mkokay commented Dec 6, 2015

I did all this, and when I run node -v - it still gives me a version number. What can I do?

@mpukit

This comment has been minimized.

Copy link

mpukit commented Dec 9, 2015

Worked like a charm - thanks!

@mignonnesaurus

This comment has been minimized.

Copy link

mignonnesaurus commented Dec 16, 2015

Great Job, Tony! Thank you! ๐Ÿ‘ ๐Ÿ’ฏ

@mhanel

This comment has been minimized.

Copy link

mhanel commented Jan 12, 2016

Awesome, thank you!

@iscott

This comment has been minimized.

Copy link

iscott commented Jan 12, 2016

Thank you!!! Such a huge help

@jamc92

This comment has been minimized.

Copy link

jamc92 commented Jan 14, 2016

Priceless!

@iamlos

This comment has been minimized.

Copy link

iamlos commented Feb 13, 2016

Thanks! Helped me a lot!

@andrepedroso

This comment has been minimized.

Copy link

andrepedroso commented Feb 16, 2016

Thanks!

@pullingour

This comment has been minimized.

Copy link

pullingour commented Mar 4, 2016

Thanks. This works on El Capitan

@ghost

This comment has been minimized.

Copy link

ghost commented Mar 8, 2016

Thanks!

@magichim

This comment has been minimized.

Copy link

magichim commented Mar 13, 2016

Wow..Thanks!!

@miguelplazasr

This comment has been minimized.

Copy link

miguelplazasr commented Mar 17, 2016

Itยดs work! Thanks

@aflansburg

This comment has been minimized.

Copy link

aflansburg commented Apr 11, 2016

Perfect! Now I can start with a clean slate -- thanks. (OSx El Capitan 10.11.4)

@shmuel-web

This comment has been minimized.

Copy link

shmuel-web commented Apr 23, 2016

10x => thanks
this worked for me as well

@bananamariap

This comment has been minimized.

Copy link

bananamariap commented Apr 25, 2016

Works! Thank you.

@lorimweb

This comment has been minimized.

Copy link

lorimweb commented May 7, 2016

Good Job! Thank you.

@kheast

This comment has been minimized.

Copy link

kheast commented May 13, 2016

Thanks very much!

I am totally baffled by the attitude nodejs has about installation, removal, and security, especially for a project of its size. To get npm to work, they want me to chmod 777 /usr/local/lib. Ain't gonna' happen. And now that I've refused to do that, I wish to uninstall. But wait, there's no uninstaller. WTF?

@adebigare

This comment has been minimized.

Copy link

adebigare commented May 28, 2016

Thank you so so so so so much! This is an amazing resource and I am eternally grateful to you for compiling it. Karma will be good to you in the future, I'm sure!

@jv1971

This comment has been minimized.

Copy link

jv1971 commented Jun 1, 2016

Thanks a lot.

@SetantaBear

This comment has been minimized.

Copy link

SetantaBear commented Jun 13, 2016

Awesome - I had a lot of trouble until i found your post, worked a treat, thank you

@RameshAran

This comment has been minimized.

Copy link

RameshAran commented Jun 25, 2016

Thank you very much.

@malcolm-decuire

This comment has been minimized.

Copy link

malcolm-decuire commented Jul 2, 2016

BRUH THANK JESUS FOR YOU! I was about to lose my mind until I found this post. May God continue to bless you man :)

@rsaddey

This comment has been minimized.

Copy link

rsaddey commented Jul 3, 2016

Hi Tony! I'm evaluating a different approach: Instead of trying to find and remove left-overs, I try to keep the deamon within a Docker bottle in the first place: https://blog.saddey.net/2016/07/03/using-docker-to-create-ionic-2-pwa-developer-environment/ Does this make any sense?

@FullHeleno

This comment has been minimized.

Copy link

FullHeleno commented Jul 10, 2016

Thanks a lot Tony.

@whaaaley

This comment has been minimized.

Copy link

whaaaley commented Jul 11, 2016

This helped solved my problem with brew postinstall node, after multiple attempts to remove node to reinstall. So thanks!

@isax5

This comment has been minimized.

Copy link

isax5 commented Jul 14, 2016

Thanks tonymtz

@nsieber

This comment has been minimized.

Copy link

nsieber commented Jul 22, 2016

Thanks for this

@earthday

This comment has been minimized.

Copy link

earthday commented Aug 1, 2016

Thanks, it works well.

@sovanna

This comment has been minimized.

Copy link

sovanna commented Aug 4, 2016

Thanks, works too.
as mentioned by @e2tha-e, I had to change the filename from org.nodejs.pkg.bom to org.nodejs.node.pkg.bom for OSX El Capitain

@kiley0

This comment has been minimized.

Copy link

kiley0 commented Aug 12, 2016

Thanks -- worked great for me. Was having problems with gulp so uninstalled homebrew, then removed node, then removed gulp, then reinstalled node from the node.js website, then npm install gulp and everything's working well now!

@clarketm

This comment has been minimized.

Copy link

clarketm commented Aug 18, 2016

Spectacularly flawless!

@shasti86

This comment has been minimized.

Copy link

shasti86 commented Aug 24, 2016

Thanks!

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 27, 2016

Thank you! Although I didn't installed from brew. This helped me =)

@AurelienBg

This comment has been minimized.

Copy link

AurelienBg commented Aug 29, 2016

Thanks a lot! (except lines 1-3 "# first:", everything worked perfectly! Hope it does the same..)

@Karla-Isabel-Sandoval

This comment has been minimized.

Copy link

Karla-Isabel-Sandoval commented Sep 20, 2016

sudo rm -rf node* This worked really well for me after trying several other options.

@RodrigoIbarraSanchez

This comment has been minimized.

Copy link

RodrigoIbarraSanchez commented Sep 21, 2016

Thanks bro!

@jguix

This comment has been minimized.

Copy link

jguix commented Sep 22, 2016

For anyone -like me- afraid of typing random commands in bash, I'd suggest the following variation (3 steps instead of 2):

# Create intermediate file
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom >> ~/filelist.txt

# Manually review your file, for instance 'open -t ~/filelist.txt'

# If it make sense for you, then delete the files
cat ~/filelist.txt | 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.*

@jguix

This comment has been minimized.

Copy link

jguix commented Sep 22, 2016

By the way, it worked and I am inmensely thankful for that to you ๐Ÿ‘

@tomka88

This comment has been minimized.

Copy link

tomka88 commented Oct 3, 2016

It worked like charm, thanks a lot!

@RDelorier

This comment has been minimized.

Copy link

RDelorier commented Oct 5, 2016

Thanks!

@lutfiqaraman

This comment has been minimized.

Copy link

lutfiqaraman commented Oct 13, 2016

Thanks :)

@ghost

This comment has been minimized.

Copy link

ghost commented Oct 14, 2016

Awesome. Thanks !

@sigi0302

This comment has been minimized.

Copy link

sigi0302 commented Oct 17, 2016

Thanks, it's wonderful !!!

@alexTitakoff

This comment has been minimized.

Copy link

alexTitakoff commented Oct 19, 2016

thanks man! +1

@aakos

This comment has been minimized.

Copy link

aakos commented Oct 19, 2016

Priceless. Thanks a lot!

@abderrazak-bouadma

This comment has been minimized.

Copy link

abderrazak-bouadma commented Oct 20, 2016

Thanks

@shreezan123

This comment has been minimized.

Copy link

shreezan123 commented Oct 25, 2016

Thank you!

@gavinmcnamee

This comment has been minimized.

Copy link

gavinmcnamee commented Nov 3, 2016

Thanks...worked great!!!

@Pix---

This comment has been minimized.

Copy link

Pix--- commented Nov 14, 2016

Thank you, worked. ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘

@zenojr

This comment has been minimized.

Copy link

zenojr commented Nov 21, 2016

Great!! tks!!

@cirocfc

This comment has been minimized.

Copy link

cirocfc commented Nov 22, 2016

thanks!

@Blockshot12

This comment has been minimized.

Copy link

Blockshot12 commented Nov 23, 2016

Thanks!

@spontoreau

This comment has been minimized.

Copy link

spontoreau commented Nov 27, 2016

Thanks :)

@Nilloc

This comment has been minimized.

Copy link

Nilloc commented Nov 30, 2016

What about the ~/.node_repl_history and ~/.node-gyp, I'm gonna assume those should go too...

@fuse-mars

This comment has been minimized.

Copy link

fuse-mars commented Dec 5, 2016

thanks :)

@djego

This comment has been minimized.

Copy link

djego commented Dec 14, 2016

Thank you very much ๐Ÿ‘

@jwerre

This comment has been minimized.

Copy link

jwerre commented Dec 21, 2016

Worked for me in OSX Sierra (10.12.1) ๐Ÿ‘

@bartread

This comment has been minimized.

Copy link

bartread commented Dec 21, 2016

+1 from me. Thanks very much for posting.

@koistya

This comment has been minimized.

Copy link

koistya commented Dec 23, 2016

Also /usr/local/share/doc/node

@srish

This comment has been minimized.

Copy link

srish commented Dec 28, 2016

This as well /usr/local/share/systemtap/tapset/node.stp

@vishnubalajikm

This comment has been minimized.

Copy link

vishnubalajikm commented Dec 28, 2016

Thanks.

@coderbag

This comment has been minimized.

Copy link

coderbag commented Jan 12, 2017

I couldn't uninstall Node by this way.

@isfaragi

This comment has been minimized.

Copy link

isfaragi commented Jan 25, 2017

me too, couldn't uninstall Node.js by this way
after this way, I run node -v in the terminal, it showed me v6.9.4
I'm using macOS 10.11.6
Any idea?
thanks

@fgerschau

This comment has been minimized.

Copy link

fgerschau commented Jan 29, 2017

Thank you! It helped me a lot

@jeremyott

This comment has been minimized.

Copy link

jeremyott commented Jan 31, 2017

This did the trick for me. Thank you!

@sonjudan

This comment has been minimized.

Copy link

sonjudan commented Jan 31, 2017

thanks

@prachetos

This comment has been minimized.

Copy link

prachetos commented Feb 17, 2017

Thanks ๐Ÿ‘

@nickstoneman

This comment has been minimized.

Copy link

nickstoneman commented Feb 18, 2017

omy4rkngod! thank you :-)

@ghost

This comment has been minimized.

Copy link

ghost commented Mar 7, 2017

๐Ÿ‘

@netojose

This comment has been minimized.

Copy link

netojose commented Mar 12, 2017

Great! Thanks

@nialen

This comment has been minimized.

Copy link

nialen commented May 10, 2017

Thanks a lot, it's useful

@rafaltectonic

This comment has been minimized.

Copy link

rafaltectonic commented May 23, 2017

Exactly what I was looking for - much appreciated!

@Nishantrenovite

This comment has been minimized.

Copy link

Nishantrenovite commented May 24, 2017

thanks a lot

@jonyfs

This comment has been minimized.

Copy link

jonyfs commented Jun 1, 2017

Thanks!

@sergeytkachenko

This comment has been minimized.

Copy link

sergeytkachenko commented Jun 1, 2017

Thanks!

@dhniels

This comment has been minimized.

Copy link

dhniels commented Jun 5, 2017

Does this still work on MacOS Sierra?

@Rayraegah

This comment has been minimized.

Copy link

Rayraegah commented Jun 14, 2017

@dhniels I just used it to remove node v7.7 on Sierra. To be clear, I installed node v7 a long time ago on El Captain, upgraded my OS to Sierra and used this method to uninstall node and npm.

@jrick1229

This comment has been minimized.

Copy link

jrick1229 commented Jun 16, 2017

30 minutes I searched for a way to uninstall this unneeded program. 30 seconds to install and no easy way to uninstall, until you.
Thank you very much!!! This worked perfectly.

@TomPyle

This comment has been minimized.

Copy link

TomPyle commented Jun 29, 2017

This was a great checklist for files to find and purge; many thanks!

@tylerwiegand

This comment has been minimized.

Copy link

tylerwiegand commented Jul 2, 2017

You'd think they'd have made a script by now, but no. You're the man!

@mackinven

This comment has been minimized.

Copy link

mackinven commented Sep 10, 2017

worked. thank you.

@Mattssonm

This comment has been minimized.

Copy link

Mattssonm commented Oct 8, 2017

Thank you so much! ๐Ÿฅ‡

@fuchao2012

This comment has been minimized.

Copy link

fuchao2012 commented Oct 10, 2017

macOS High Sierra runs

sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}

works for me.

@rbotha

This comment has been minimized.

Copy link

rbotha commented Oct 11, 2017

Amazing. You have just saved me.

@ottodevs

This comment has been minimized.

@khalid5050

This comment has been minimized.

Copy link

khalid5050 commented Nov 3, 2017

Thank you so much!

@Iranthi

This comment has been minimized.

Copy link

Iranthi commented Dec 4, 2017

thank you very much...

@esmerino

This comment has been minimized.

Copy link

esmerino commented Dec 18, 2017

Thanks you so much

@avneechadha

This comment has been minimized.

Copy link

avneechadha commented Dec 19, 2017

Thanks Tony!

@LinXiaoBao

This comment has been minimized.

Copy link

LinXiaoBao commented Jan 7, 2018

Thanks !

@brjairosanches

This comment has been minimized.

Copy link

brjairosanches commented Jan 19, 2018

Thanks so much! Very useful! Here works fine on macOS High Sierra 10.13.2

@elisabeth-sorrell

This comment has been minimized.

Copy link

elisabeth-sorrell commented Jan 19, 2018

Thx!

@andmpel

This comment has been minimized.

Copy link

andmpel commented Feb 7, 2018

Thank you! Worked on Mac OS High Sierra 10.13.4 beta

@samithaj

This comment has been minimized.

Copy link

samithaj commented Feb 10, 2018

Thanks !!
Worked on Mac OS High Sierra

@alisonludick

This comment has been minimized.

Copy link

alisonludick commented Feb 13, 2018

Thank you, a million times over!
Worked on Mac OS Yosemite 10.10.5

@jose-almeida

This comment has been minimized.

Copy link

jose-almeida commented Feb 15, 2018

Cool! Thanks

@zatmar

This comment has been minimized.

Copy link

zatmar commented Feb 15, 2018

Thanks dude!

@woelfle

This comment has been minimized.

Copy link

woelfle commented Apr 22, 2018

Great. Many thranks

@HongJheLi

This comment has been minimized.

Copy link

HongJheLi commented Apr 27, 2018

Wonderful tips. Thank you so much.

@ghost

This comment has been minimized.

Copy link

ghost commented Jun 12, 2018

THNX

@erperejildo

This comment has been minimized.

Copy link

erperejildo commented Jul 12, 2018

after all of this when I type node -v still showing me v6.14.3

@abdelhakim-85

This comment has been minimized.

Copy link

abdelhakim-85 commented Nov 9, 2018

Thank you so much it helped me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment