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:
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.