brew install mongodb
#Step 1 $ brew tap mongodb/brew #Step 2 to install latest community version $ brew install mongodb-community
Here is what the above code is Doing:
1. The first line is telling Homebrew to tap into the MongoDB Homebrew repository.
2. The second line is telling Homebrew to install the latest version of MongoDB.