How to uninstall MongoDB from Mac

If you’ve installed MongoDB on your Mac, perhaps using MongoDB Compass as a graphical user interface for its front end, and no longer use it, you should uninstall it. Leaving any software that you don’t use on your Mac not only takes up space on your boot drive but also risks conflicts with other software in the future. It’s important when you uninstall any application that you remove all of the files that it saved on your Mac while it was installed, including preference files and caches. Only by doing that will you free up the maximum possible space and eliminate the possibility of future conflicts. We’ll show you how to completely uninstall MongoDB from Mac in this article.

What is MongoDB?

MongoDB is a cross-platform, distributed document-based database. It’s a type of database known as ‘non-SQL’ because it doesn’t store data under schemas and tables where every table has a fixed structure. Instead, it stores collections of data as JSON-based documents. This has a few advantages over SQL databases, such as making it easy to store and retrieve large amounts of data efficiently.

MongoDB Compass is the graphical user interface (GUI) that allows you to interrogate a MongoDB database in a visual environment instead of having to type in commands on a command line interface.

Why uninstall MongoDB?

Why uninstall MongoDB Mac users may wonder. It is the same reason you should uninstall any software you don’t use. Leaving it on your Mac takes up space and can make your Mac vulnerable to conflicts with applications and files that are installed subsequently. And when you don’t use an application, you are much less likely to keep it updated. Out-of-date software leaves your Mac vulnerable to malware. So, it’s good practice to uninstall any applications or utilities you don’t use.

Tip

How to uninstall multiple apps simultaneously from your Mac

All apps selected in the Uninstaller module of CMMX

As you will see below, there are lots of steps needed to uninstall MongoDB. And while most applications don’t need quite that many steps, if you want to uninstall any app completely from your Mac, you will need to remove all the files it installed. That means tracking them down individually and dragging them to the Trash. That’s a lot of time and effort. If the app in question has its own uninstaller, you can use that.

If not, you should use a third-party tool that’s designed for uninstalling applications for your Mac. There are several available, but we recommend CleanMyMac X. It’s quick and easy to use and allows you to uninstall multiple applications at the same time. You can download it for free here.

  1. Open CleanMyMac X from your Applications folder.
  2. Choose the Uninstaller module in the sidebar.
  3. Locate the applications you want to uninstall (Hint: you can search for them in the search box or use the filters in the middle pane).
  4. Select the box next to the applications you want to uninstall.
  5. Click the Uninstall button.

That’s all you need to do to uninstall several applications at the same time, removing all their associated files.





How to uninstall MongoDB Compass manually

There are several steps needed to completely uninstall MongoDB manually. Make sure you follow them all to completely remove it from your Mac.

  1. Navigate to your Applications folder in the Finder.
  2. Double-click Applications to open it and locate MongoDB Compass.
  3. Drag MongoDB Compass to the Trash and empty it afterward.
  4. In the Finder, click Go > Go to Folder and paste each of the file paths below into the window one by one, pressing Return each time. In each folder, look for files or folders with MongoDB in their name and drag them to the Trash.

    ~/Library
    ~/Library/Caches
    ~/Library/Preferences
    ~/Library/Application Support
    ~/Library/LaunchAgents
    ~/Library/LaunchDaemons
    ~/Library/PreferencePanes
    ~/Library/StartupItems
  5. Empty the Trash

How to uninstall MongoDB from your Mac

Now that you’ve uninstalled Compass, you also need to delete the MongoDB database itself. You do this using Terminal, and the steps are dependent on whether you used Homebrew or Brew to install it or installed it manually.

Homebrew

  1. Use this command to check if MongoDB is running:
    launchctl list | grep mongo
  2. Unload MongoDB using the commands below: 

    launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

    rm -f ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

    launchctl remove homebrew.mxcl.mongodb-community

  3. Kill the MongoDB process with this command: pkill -f mongod

Brew

Use the commands below to uninstall MangoDB:

brew uninstall mongodb-community

brew uninstall mongodb-database-tools

brew uninstall mongosh

brew untap mongodb/brew

Manually

If you installed MongoDB manually, type this command in Terminal:
rm -rf

Now, drag your MongoDB database folder onto the Terminal window and press Return.

To remove MongoDB database after uninstalling it, type:
rm -rf /usr/local/var/mongodb

To check that the uninstall was completed fully, use this command
ls -al /usr/local/bin/mongo*

Once you’ve completed the appropriate steps above for the installation method you used and established that there are no more MongoDB files left on your Mac, you can quit Terminal. MongoDB has been uninstalled from your Mac. 

MongoDB is a non-SQL distributed document-based database that runs on Mac, Windows, and Linux. It has a GUI for interrogating and manipulating the data called Compass. If you’ve installed MongoDB on your Mac and now no longer use it, you should uninstall it. The method for doing that is two-fold. You need to uninstall Compass and then uninstall the database itself and remove the data. The second part is done in Terminal, and the commands depend on how you installed it. Follow the steps above, and you’ll uninstall MongoDB and remove all of its data. If you need to uninstall multiple apps at the same time, the quickest method is to use a third-party uninstaller like CleanMyMac X that will remove all the files associated with the apps quickly and easily.

Laptop with CleanMyMac
CleanMyMac X

Your Mac. As good as new.