30

I am running these simple commands on mac:

brew upgrade mongodb

or

brew install mongodb

I am getting this error below:

Error: mongodb: unknown version :mountain_lion

If I run the simple command: mongo , I get this,

MongoDB shell version v4.0.3

But then I get an error saying couldn't connect to server

Worth to note, I was playing around with the command line last night and somehow deleted all of my databases from mongodb on my machine (I think). I continuously get the above error when trying install and/or update mongodb.

I am "new" to mongoDB, but I have created a few full stack projects using it over the last 5-6 months. Not sure what I did, but I also can't run node db/seeds.js either as I get errors, even though I have the data in my vscode projects.

I've tried simply updating and installing mongodb. I also tried some simple server commands but was unsuccessful.

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
Tray Fleary
  • 421
  • 1
  • 4
  • 9
  • What version of OS X are you using? Is it actually Mountain Lion (10.8.x)? – Stennie Sep 02 '19 at 21:03
  • @Stennie I am running macOS High Sierra version 10.13.6.. problem is still not solved as when I run mongo commands it gives me the error of.. Error: mongodb: unknown version :mountain_lion – Tray Fleary Sep 03 '19 at 01:10
  • 1
    Try following the instructions to [Install MongoDB 4.0 using the Homebrew Tap](https://docs.mongodb.com/v4.0/tutorial/install-mongodb-on-os-x/). I'm not sure why you're getting the error message about `mountain_lion`, but the official Tap is a different formula from the one you are trying to install. Hopefully your missing data files are still present in the default Homebrew path of `/usr/local/var/mongodb` and will be used when you are able to successfully install and start the MongoDB server using `brew services start mongodb/brew/mongodb-community`. – Stennie Sep 03 '19 at 04:42
  • Thank you for the reply and clarity @Stennie ! – Tray Fleary Sep 16 '19 at 19:11
  • @TrayFleary have you found any solution ? – Kishan Bharda Jan 20 '20 at 12:48

3 Answers3

34

It seems the mongodb tap was moved. This worked for me:

levsa
  • 930
  • 9
  • 16
  • I saw the original error when I ran `brew doctor`. After following this solution, I now get `Your system is ready to brew.` – Mr. J Apr 03 '20 at 03:33
26

Unfortunately, MongoDB has been removed from homebrew-core.

But... MongoDB team maintains a custom Homebrew tap.

I've uninstalled the old MongoDB:

brew services stop mongodb

brew uninstall mongodb

and reinstalled the new tap:

brew tap mongodb/brew

brew install mongodb-community

brew services start mongodb-community

Source: mongobd/homebrew-brew Readme.md

Good luck!

David Bendahan
  • 4,104
  • 1
  • 24
  • 21
0

Your system may be too old. Apparently mongo doesn't support older Mac systems - below 10.12 for community edition and 10.11 for enterprise.

Check this: SO link and the supported systems page on the mongo site

Steve
  • 1,903
  • 5
  • 22
  • 30
  • 1
    I am confused because my system says that I am running macOS High Sierra version 10.13.6. – Tray Fleary Sep 02 '19 at 22:49
  • Good to hear you solved it. Was it related to an older OS version or was the message a red herring? – Steve Sep 16 '19 at 20:54
  • It was definitely misleading. My version was updated to High Sierra at the time. I found that it was a problem with how I was using mongoDB, as homebrew recently removed it from core formulas and is maintaining a homebrew tap. As far as mountain lion, I am still not sure why my command line stated that this is what I was running. – Tray Fleary Sep 16 '19 at 21:10