Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
remove mongodb that was installed via brew
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep mongo
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl remove homebrew.mxcl.mongodb
pkill -f mongod
rm -f ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
brew uninstall mongodb
# double check existence
ls -al /usr/local/bin/mong*
ls -al ~/Library/LaunchAgents
@meddy672

This comment has been minimized.

Copy link

@meddy672 meddy672 commented Feb 14, 2016

Big thanks!

@jonasalmeida

This comment has been minimized.

Copy link

@jonasalmeida jonasalmeida commented Mar 5, 2016

indeed - thank you !

@avneechadha

This comment has been minimized.

Copy link

@avneechadha avneechadha commented Mar 12, 2016

Thanks!

@angelxmoreno

This comment has been minimized.

Copy link

@angelxmoreno angelxmoreno commented Mar 23, 2016

what about the data dirs?

@piotrd

This comment has been minimized.

Copy link

@piotrd piotrd commented Apr 5, 2016

Thanks for the script.

Removing /usr/local/var/mongodb would be worth mentioning - I have that dir left.

@ebragaparah

This comment has been minimized.

Copy link

@ebragaparah ebragaparah commented Apr 6, 2016

Uhul! Awesome! Like a charm!

@jaykodeveloper

This comment has been minimized.

Copy link

@jaykodeveloper jaykodeveloper commented Apr 8, 2016

Does anyone know how to remove /data/db which I made when I install mongodb?
I ran mkdir -p /data/db and want to even delete this one.

@rytch14

This comment has been minimized.

Copy link

@rytch14 rytch14 commented Jul 23, 2016

You just run rm -r /data/db/ with su privileges

@mr-nicky

This comment has been minimized.

Copy link

@mr-nicky mr-nicky commented Jul 28, 2016

Awesome )

@RafaelPlantard

This comment has been minimized.

Copy link

@RafaelPlantard RafaelPlantard commented Aug 25, 2016

Guys, If I delete my /usr/local/var/mongodb contents I can continue to use the same installation of mongodb even than all my databases were lost?

@Anixed

This comment has been minimized.

Copy link

@Anixed Anixed commented Sep 27, 2016

thanks!!

@jfhsieh

This comment has been minimized.

Copy link

@jfhsieh jfhsieh commented Oct 16, 2016

Thanks!

@jwilber

This comment has been minimized.

Copy link

@jwilber jwilber commented Nov 15, 2016

Thanks!

@ShahNewazKhan

This comment has been minimized.

Copy link

@ShahNewazKhan ShahNewazKhan commented Feb 16, 2017

Thanks!

@ronmeneses

This comment has been minimized.

Copy link

@ronmeneses ronmeneses commented Apr 21, 2017

Thanks!!

@msguner

This comment has been minimized.

Copy link

@msguner msguner commented May 3, 2017

thanks.

@GuillaumeRx

This comment has been minimized.

Copy link

@GuillaumeRx GuillaumeRx commented May 24, 2017

Thanks a lot !

@crrollyson

This comment has been minimized.

Copy link

@crrollyson crrollyson commented Jun 22, 2017

Awesome, thanks!

@nitin7dc

This comment has been minimized.

Copy link

@nitin7dc nitin7dc commented Aug 11, 2017

thanks !

@jerolba

This comment has been minimized.

Copy link

@jerolba jerolba commented Aug 14, 2017

thanks !

@roysG

This comment has been minimized.

Copy link

@roysG roysG commented Aug 18, 2017

Thanks!

@jiovan

This comment has been minimized.

Copy link

@jiovan jiovan commented Aug 23, 2017

Thanks :)

@AshishDev17

This comment has been minimized.

Copy link

@AshishDev17 AshishDev17 commented Sep 5, 2017

Thanks!

@iamkiet

This comment has been minimized.

Copy link

@iamkiet iamkiet commented Sep 17, 2017

thanks ;)

@CrystalCodes01

This comment has been minimized.

Copy link

@CrystalCodes01 CrystalCodes01 commented Nov 3, 2017

Many thanks!

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Nov 27, 2017

Thanks :)

@myf9000

This comment has been minimized.

Copy link

@myf9000 myf9000 commented Dec 24, 2017

Thanks :)

@aderjaan

This comment has been minimized.

Copy link

@aderjaan aderjaan commented Dec 27, 2017

Yay! Thx!

@arvi

This comment has been minimized.

Copy link

@arvi arvi commented Jan 20, 2018

Thank you so much. I had issues with mongorestore on Mac OS High Sierra so I uninstalled installed mongodb through homebrew 😄

@james-carlson

This comment has been minimized.

Copy link

@james-carlson james-carlson commented Feb 19, 2018

Thanks!

@sjtugaoman

This comment has been minimized.

Copy link

@sjtugaoman sjtugaoman commented Mar 16, 2018

thanks

@mitchellsuter

This comment has been minimized.

Copy link

@mitchellsuter mitchellsuter commented Apr 16, 2018

Thanks

@Llibyddap

This comment has been minimized.

Copy link

@Llibyddap Llibyddap commented Apr 29, 2018

This was a great script and had everything in it.

@yatender-oktalk

This comment has been minimized.

Copy link

@yatender-oktalk yatender-oktalk commented May 3, 2018

works like charm :) big thank you

@caidicaidi123

This comment has been minimized.

Copy link

@caidicaidi123 caidicaidi123 commented Jun 26, 2018

Big thanks!

@meshin

This comment has been minimized.

Copy link

@meshin meshin commented Jul 25, 2018

Thanks!

@humbertowoody

This comment has been minimized.

Copy link

@humbertowoody humbertowoody commented Jul 28, 2018

Thanks! :)

@salmuzblues

This comment has been minimized.

Copy link

@salmuzblues salmuzblues commented Sep 15, 2018

Thanks, Brother.

@davens

This comment has been minimized.

Copy link

@davens davens commented Dec 26, 2018

Much appreciated

@charles01

This comment has been minimized.

Copy link

@charles01 charles01 commented Feb 7, 2019

Thank you so much.

@matthewmjm

This comment has been minimized.

Copy link

@matthewmjm matthewmjm commented Feb 24, 2019

Thank you SO much!

@bdelville

This comment has been minimized.

Copy link

@bdelville bdelville commented Apr 2, 2019

Thanks!
Coould also add:
rm /usr/local/etc/mongod.conf

@uchennaegbo

This comment has been minimized.

Copy link

@uchennaegbo uchennaegbo commented Aug 7, 2019

Thanks a bunch.

@akshithrk

This comment has been minimized.

Copy link

@akshithrk akshithrk commented Sep 13, 2019

Thanks...!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.