Error: mongodb: unknown version :mountain_lion

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 maintained a custom Homebrew tap. You can uninstall the old mongodb and reinstall the new one from the new tap.

brew services stop mongodb
brew uninstall mongodb

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

Check mongodb/homebrew-brew for more info.


MongoDB is maintaining an homebrew tap. So, I think it's the recommanded way to setup mongodb. If you're running mongodb from the homebrew tap, both are using the same config and db files, so it's safe to change the mongodb install.

# -> Firstly, it's a good reflex to run the following command, to ensure that you don't have any other error
brew doctor
# -> Secondly, ensure that mongodb is not running, in your case, this command will return, probably, "mongodb: unknown version :mountain_lion"
brew services stop mongodb
# -> Install the homebrew tap
brew tap mongodb/brew
# -> Uninstall old homebrew, maybe you will have to rerun this command later with --force flag
brew uninstall mongodb
# -> Install mongodb from mongodb tap
brew install mongodb-community
# -> Ensure that you can access your db, and everything is working, then you can run uninstall again with --force flag.

mongodb was removed from brew, so you should do the following:

1) which mongo if you want to verify your installation

2) brew uninstall mongodb

3) brew install mongodb-community

4) brew services start mongodb-community

and ready!!!