Installing MongoDB with Homebrew
Formula mongodb
has been removed from homebrew-core. Check pr-43770 from homebrew-core
To our users: if you came here because mongodb stopped working for you, we have removed it from the Homebrew core formulas since it was migrated to a non open-source license.
Fortunately, the team of mongodb is maintaining a custom Homebrew tap. You can uninstall the old mongodb and reinstall the new one from the new tap.
brew services stop mongodbbrew uninstall homebrew/core/mongodbbrew tap mongodb/brewbrew install mongodb-communitybrew services start mongodb-community
Check mongodb/homebrew-brew for more info.
first install mongodb
brew tap mongodb/brew
Secondly install using this command. mangodb successfully installed
brew install mongodb-community@4.0
You will get the output
==> CaveatsTo have launchd start mongodb/brew/mongodb-community now and restart at login: brew services start mongodb/brew/mongodb-communityOr, if you don't want/need a background service you can just run: mongod --config /usr/local/etc/mongod.conf==> Summary🍺 /usr/local/Cellar/mongodb-community/4.2.2: 21 files, 274.5MB, built in 2 minutes 46 secondsbrew services start mongodb/brew/mongodb-community==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-commu
With regards to macOS Big Sur
and Homebrew
the mongodb documentation states: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
You should install MongoDB 4.4 Community Edition which supports macOS 10.13 or later, Therefor these steps will be helpful.
SOLUTION 1:If you have previously installed an older version of the formula, you may encounter a ChecksumMismatchError
to fix that:
Remove the downloaded .tgz archive.
brew untap mongodb/brew && brew tap mongodb/brew
Retap the formula.
brew install mongodb-community@4.4
SOLUTION 2:If you haven't installed any version of the formula.
1, Install the Xcode command-line tools and the Homebrew from https://brew.sh/#install
xcode-select --install
2, Tap the MongoDB Homebrew Tap:
brew tap mongodb/brew
3, Verify installation prerequisites in the macOS Terminal:
brew tap | grep mongodb
4, install MongoDB
brew install mongodb-community@4.4
Note: The installation includes:
• The mongod server,
• The mongos sharded cluster query router,
• The mongo shell
refer to this screenshot:
Finally to run MongoDB (i.e. the mongod process) as a macOS service, issue the following:
brew services start mongodb-community@4.4
screenshot: