You can use Homebrew to install MongoDB on a Mac.

For ages you were able to simply do:

brew install mongodb, but more recently, that has stopped working as it was removed from homebrew-core. Now, you need to do it as follows:

1
2
3
4
5
6
brew services stop mongodb
brew uninstall mongodb

brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community

You can read more about it here if you’d like.