伟大伟大

How to uninstall MongoDB from Mac

To completely delete any version of MongoDB from Mac, follow the below steps on the terminal:

Check if any mongo service is running:

launchctl list | grep mongo
If you had installed MongoDB using Homebrew, unload mongodb:

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
rm -f ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
launchctl remove homebrew.mxcl.mongodb-community
Kill the mongod process, if it exists:

pkill -f mongod
If you had installed MongoDB using brew, uninstall MongoDB with the below command:

brew uninstall mongodb-community
brew uninstall mongodb-database-tools
brew uninstall mongosh
brew untap mongodb/brew
If you installed MongoDB manually (without Homebrew), then use:

rm -rf <yourmongodb_folder>
Remove database files:

rm -rf $(brew --prefix)/var/mongod
To check if the uninstall was properly done, check if any MongoDB files are still present:

ls -al /usr/local/bin/mongo*
zsh: no matches found: /usr/local/bin/mongo*

ref:
https://www.mongodb.com/basics/uninstall-mongodb

posted @ 2023-07-28 10:27  wooHsi  阅读(66)  评论(0)    收藏  举报