We know macOS users love using?Homebrew, aka Brew, "the missing package manager for macOS". Its made life so much simpler when installing both open source and freely available applications. It's also?not?a centralized package system - it lets anyone create a tap to make their software available. That is why we are very happy to announce that we now have our own official MongoDB Tap which makes it simpler than ever to install the latest MongoDB.
Opening the Tap
As it’s our own Brew Tap, you need to add it to your list of taps. That’s simply a matter of adding the tap.
$ brew tap mongodb/brew
Now we’re ready to pour.
Pouring from the Tap
If you want to install the latest full release of MongoDB Community edition complete with tools, it is as simple as running:
$ brewinstallmongodb-community
There is one tool which people often want to install on its own, and that’s the MongoDB shell. It’s handy if you are connecting to a server somewhere else on your network or your MongoDB Atlas clusters. If you want just the shell then run:
$ brewinstallmongodb-community-shell
Other Flavors
To make the server simple to start and stop, the?brew services?command is supported. To start the server just do:
$ brew services start mongodb-community
And, of course, to stop it cleanly do:
$ brew services stop mongodb-community
You can also install older versions of MongoDB using Brew’s version specifier. If you need to install MongoDB 3.6, for example, then you would run:
$ brewinstallmongodb-community@3.6
This installs the latest patch level of 3.6 so, as of writing, this would be 3.6.12. There's currently options for 3.4 and 3.6.
Talking about versions, you can start an upgrade from one MongoDB version to another with another quick command:
$ brew upgrade mongodb-community
As with all upgrades, we do recommend you have a backup before running that though. Oh, and if you are wondering how you update the Brew Formula installed on your machine, don't worry, Brew does Formula updates automatically. One final note, the command?brew info mongodb-community?will give you details on what version you have installed, where it came from and a reminder on how to use those?brew services?commands to start and stop things.
All Open
If you find it useful, you’ll find more information in the GitHub repository for the MongoDB Formula, https://github.com/mongodb/homebrew-brew. If you want to improve the Formula then we are always ready for pull requests. You can also leave any feedback there via Github issues.
Enjoy the refreshing new way to install MongoDB on your Mac.