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.

tristankirkpatrick commented Jun 13, 2015

Thanks - this worked a treat.

@carmelyne

This comment has been minimized.

carmelyne commented Jun 17, 2015

Thanks. Its a very helpful guide.

@emrais

This comment has been minimized.

emrais commented Jun 27, 2015

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

@stevenchanin

This comment has been minimized.

stevenchanin commented Jul 2, 2015

Thanks very much for making the time to post these

@hamdiceylan

This comment has been minimized.

hamdiceylan commented Jul 2, 2015

I've been looking like this commands. Thank you

@jumpinjan

This comment has been minimized.

jumpinjan commented Jul 6, 2015

Thank you! very helpful

@maxarouca

This comment has been minimized.

maxarouca commented Jul 22, 2015

Great Job. Thank you!

@mpepping

This comment has been minimized.

mpepping commented Jul 25, 2015

Great help .. thnx!

@lclghst

This comment has been minimized.

lclghst commented Jul 30, 2015

Thanks Tony ๐Ÿ‘

@sethwklein

This comment has been minimized.

sethwklein commented Jul 31, 2015

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

@Tokuriku

This comment has been minimized.

Tokuriku commented Aug 1, 2015

Awesome stuff!

@idautocfator

This comment has been minimized.

idautocfator commented Aug 4, 2015

Strange that its so complicated to uninstall node.

@skapil

This comment has been minimized.

skapil commented Aug 5, 2015

Thanks for writing this.

@jfmercer

This comment has been minimized.

jfmercer commented Aug 11, 2015

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

@theednaffattack

This comment has been minimized.

theednaffattack commented Aug 17, 2015

Dope, dude. Thank you.

@paulkore

This comment has been minimized.

paulkore commented Aug 24, 2015

Awesome! Thanks a bunch! ๐Ÿ‘

@scottdavidcraig

This comment has been minimized.

scottdavidcraig commented Sep 3, 2015

Hero

@jsonCummings

This comment has been minimized.

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.

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.

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.

nick2474 commented Sep 10, 2015

Great its help me alot

@alexpts

This comment has been minimized.

alexpts commented Sep 11, 2015

Thank you

@ankurarora

This comment has been minimized.

ankurarora commented Sep 12, 2015

great...worked like charm

@e2tha-e

This comment has been minimized.

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.

lawrenceleach commented Sep 13, 2015

Thank you for this.

@michahell

This comment has been minimized.

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.

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.

KloseD commented Sep 24, 2015

Thanks a lot! :)

@contrerasmarc

This comment has been minimized.

contrerasmarc commented Sep 25, 2015

Muchas gracias!

@AndrewCull

This comment has been minimized.

AndrewCull commented Sep 26, 2015

Thank you very much, worked great!

@leonardteo

This comment has been minimized.

leonardteo commented Sep 28, 2015

Thank you so much!!

@josvaler

This comment has been minimized.

josvaler commented Sep 29, 2015

Excelent script. Thank you

@adamatti

This comment has been minimized.

adamatti commented Oct 1, 2015

It saved me today. Thanks!

@javedlalani

This comment has been minimized.

javedlalani commented Oct 2, 2015

Nice work!

@PeacheyA

This comment has been minimized.

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.

lisacheng commented Oct 21, 2015

thank you for sharing this

@SteveZhangBit

This comment has been minimized.

SteveZhangBit commented Oct 27, 2015

Thanks! It works well!

@red2678

This comment has been minimized.

red2678 commented Nov 8, 2015

Worked ty

@jungcollin

This comment has been minimized.

jungcollin commented Nov 17, 2015

Thanks

@joellongie

This comment has been minimized.

joellongie commented Dec 1, 2015

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

@roblav96

This comment has been minimized.

roblav96 commented Dec 2, 2015

looking good!!!

@darkajax

This comment has been minimized.

darkajax commented Dec 2, 2015

gracias Tony, muy รบtil!

@candidodmv

This comment has been minimized.

candidodmv commented Dec 3, 2015

Thanks so much! Very useful tips.

@mkokay

This comment has been minimized.

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.

mpukit commented Dec 9, 2015

Worked like a charm - thanks!

@mignonnesaurus

This comment has been minimized.

mignonnesaurus commented Dec 16, 2015

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

@mhanel

This comment has been minimized.

mhanel commented Jan 12, 2016

Awesome, thank you!

@iscott

This comment has been minimized.

iscott commented Jan 12, 2016

Thank you!!! Such a huge help

@jamc92

This comment has been minimized.

jamc92 commented Jan 14, 2016

Priceless!

@iamlos

This comment has been minimized.

iamlos commented Feb 13, 2016

Thanks! Helped me a lot!

@andrepedroso

This comment has been minimized.

andrepedroso commented Feb 16, 2016

Thanks!

@pullingour

This comment has been minimized.

pullingour commented Mar 4, 2016

Thanks. This works on El Capitan

@ghost

This comment has been minimized.

ghost commented Mar 8, 2016

Thanks!

@magichim

This comment has been minimized.

magichim commented Mar 13, 2016

Wow..Thanks!!

@miguelplazasr

This comment has been minimized.

miguelplazasr commented Mar 17, 2016

Itยดs work! Thanks

@aflansburg

This comment has been minimized.

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.

shmuel-web commented Apr 23, 2016

10x => thanks
this worked for me as well

@bananamariap

This comment has been minimized.

bananamariap commented Apr 25, 2016

Works! Thank you.

@lorimweb

This comment has been minimized.

lorimweb commented May 7, 2016

Good Job! Thank you.

@MaDeuce

This comment has been minimized.

MaDeuce 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.

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.

jv1971 commented Jun 1, 2016

Thanks a lot.

@SetantaBear

This comment has been minimized.

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.

RameshAran commented Jun 25, 2016

Thank you very much.

@malcolm-decuire

This comment has been minimized.

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.

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.

FullHeleno commented Jul 10, 2016

Thanks a lot Tony.

@whaaaley

This comment has been minimized.

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.

isax5 commented Jul 14, 2016

Thanks tonymtz

@nsieber

This comment has been minimized.

nsieber commented Jul 22, 2016

Thanks for this

@earthday

This comment has been minimized.

earthday commented Aug 1, 2016

Thanks, it works well.

@sovanna

This comment has been minimized.

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.

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.

clarketm commented Aug 18, 2016

Spectacularly flawless!

@shasti86

This comment has been minimized.

shasti86 commented Aug 24, 2016

Thanks!

@ghost

This comment has been minimized.

ghost commented Aug 27, 2016

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

@AurelienBg

This comment has been minimized.

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.

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.

RodrigoIbarraSanchez commented Sep 21, 2016

Thanks bro!

@jguix

This comment has been minimized.

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.

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.

tomka88 commented Oct 3, 2016

It worked like charm, thanks a lot!

@RDelorier

This comment has been minimized.

RDelorier commented Oct 5, 2016

Thanks!

@lutfiqaraman

This comment has been minimized.

lutfiqaraman commented Oct 13, 2016

Thanks :)

@ghost

This comment has been minimized.

ghost commented Oct 14, 2016

Awesome. Thanks !

@sigi0302

This comment has been minimized.

sigi0302 commented Oct 17, 2016

Thanks, it's wonderful !!!

@alexTitakoff

This comment has been minimized.

alexTitakoff commented Oct 19, 2016

thanks man! +1

@aakos

This comment has been minimized.

aakos commented Oct 19, 2016

Priceless. Thanks a lot!

@abderrazak-bouadma

This comment has been minimized.

abderrazak-bouadma commented Oct 20, 2016

Thanks

@shreezan123

This comment has been minimized.

shreezan123 commented Oct 25, 2016

Thank you!

@gavinmcnamee

This comment has been minimized.

gavinmcnamee commented Nov 3, 2016

Thanks...worked great!!!

@Pix---

This comment has been minimized.

Pix--- commented Nov 14, 2016

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

@zenojr

This comment has been minimized.

zenojr commented Nov 21, 2016

Great!! tks!!

@cirocfc

This comment has been minimized.

cirocfc commented Nov 22, 2016

thanks!

@Blockshot12

This comment has been minimized.

Blockshot12 commented Nov 23, 2016

Thanks!

@spontoreau

This comment has been minimized.

spontoreau commented Nov 27, 2016

Thanks :)

@Nilloc

This comment has been minimized.

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.

fuse-mars commented Dec 5, 2016

thanks :)

@djego

This comment has been minimized.

djego commented Dec 14, 2016

Thank you very much ๐Ÿ‘

@jwerre

This comment has been minimized.

jwerre commented Dec 21, 2016

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

@bartread

This comment has been minimized.

bartread commented Dec 21, 2016

+1 from me. Thanks very much for posting.

@koistya

This comment has been minimized.

koistya commented Dec 23, 2016

Also /usr/local/share/doc/node

@srish

This comment has been minimized.

srish commented Dec 28, 2016

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

@vishnubalajikm

This comment has been minimized.

vishnubalajikm commented Dec 28, 2016

Thanks.

@coderbag

This comment has been minimized.

coderbag commented Jan 12, 2017

I couldn't uninstall Node by this way.

@isfaragi

This comment has been minimized.

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.

fgerschau commented Jan 29, 2017

Thank you! It helped me a lot

@jeremyott

This comment has been minimized.

jeremyott commented Jan 31, 2017

This did the trick for me. Thank you!

@sonjudan

This comment has been minimized.

sonjudan commented Jan 31, 2017

thanks

@prachetos

This comment has been minimized.

prachetos commented Feb 17, 2017

Thanks ๐Ÿ‘

@nickstoneman

This comment has been minimized.

nickstoneman commented Feb 18, 2017

omy4rkngod! thank you :-)

@ghost

This comment has been minimized.

ghost commented Mar 7, 2017

๐Ÿ‘

@netojose

This comment has been minimized.

netojose commented Mar 12, 2017

Great! Thanks

@nialen

This comment has been minimized.

nialen commented May 10, 2017

Thanks a lot, it's useful

@rafaltectonic

This comment has been minimized.

rafaltectonic commented May 23, 2017

Exactly what I was looking for - much appreciated!

@Nishantrenovite

This comment has been minimized.

Nishantrenovite commented May 24, 2017

thanks a lot

@jonyfs

This comment has been minimized.

jonyfs commented Jun 1, 2017

Thanks!

@sergeytkachenko

This comment has been minimized.

sergeytkachenko commented Jun 1, 2017

Thanks!

@dhniels

This comment has been minimized.

dhniels commented Jun 5, 2017

Does this still work on MacOS Sierra?

@Rayraegah

This comment has been minimized.

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.

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.

TomPyle commented Jun 29, 2017

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

@tylerwiegand

This comment has been minimized.

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.

mackinven commented Sep 10, 2017

worked. thank you.

@Mattssonm

This comment has been minimized.

Mattssonm commented Oct 8, 2017

Thank you so much! ๐Ÿฅ‡

@fuchao2012

This comment has been minimized.

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.

rbotha commented Oct 11, 2017

Amazing. You have just saved me.

@ottodevs

This comment has been minimized.

@khalid5050

This comment has been minimized.

khalid5050 commented Nov 3, 2017

Thank you so much!

@Iranthi

This comment has been minimized.

Iranthi commented Dec 4, 2017

thank you very much...

@esmerino

This comment has been minimized.

esmerino commented Dec 18, 2017

Thanks you so much

@avneechadha

This comment has been minimized.

avneechadha commented Dec 19, 2017

Thanks Tony!

@LinXiaoBao

This comment has been minimized.

LinXiaoBao commented Jan 7, 2018

Thanks !

@brjairosanches

This comment has been minimized.

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.

elisabeth-sorrell commented Jan 19, 2018

Thx!

@andmpel

This comment has been minimized.

andmpel commented Feb 7, 2018

Thank you! Worked on Mac OS High Sierra 10.13.4 beta

@samithaj

This comment has been minimized.

samithaj commented Feb 10, 2018

Thanks !!
Worked on Mac OS High Sierra

@alisonludick

This comment has been minimized.

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.

jose-almeida commented Feb 15, 2018

Cool! Thanks

@zatmar

This comment has been minimized.

zatmar commented Feb 15, 2018

Thanks dude!

@woelfle

This comment has been minimized.

woelfle commented Apr 22, 2018

Great. Many thranks

@HongJheLi

This comment has been minimized.

HongJheLi commented Apr 27, 2018

Wonderful tips. Thank you so much.

@ghost

This comment has been minimized.

ghost commented Jun 12, 2018

THNX

@erperejildo

This comment has been minimized.

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.

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