Error: mongodb: unknown version :mountain_lion

18,416

Solution 1

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.

Solution 2

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.

Solution 3

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!!!

Share:
18,416

Related videos on Youtube

Tray Fleary
Author by

Tray Fleary

Creative Full Stack Developer focused on enhancing user experience and developing scalable applications. Passionate for JavaScript, React, and Node while also having relevant experience in jQuery, JSON, Angular, MongoDB, Express, Python, SQL, Django, HTML, CSS, Git and Github, etc. Thriving from the ability to innovate and provide exponential value to everyday society. Past experiences include the automotive industry, business development & management, design, and the fashion industry while growing in entrepreneurship.

Updated on September 18, 2022

Comments

  • Tray Fleary
    Tray Fleary over 1 year

    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.

    Thanks for the help.

  • Tray Fleary
    Tray Fleary over 4 years
    Thank you for the reply.
  • Davide Carpini
    Davide Carpini over 4 years
    to start run 'brew services start mongodb-community'
  • Simba
    Simba over 4 years
    @DavideCarpini Thanks. Service related commands are added.