BrainLikeADullPencil
BrainLikeADullPencil

Reputation: 11663

Why can't I update to the latest MongoDB with Homebrew?

I have version 2.0.2 of mongo installed on my mac, which I installed using Homebrew. The course I'm taking is using the 'aggregate' function, which is only available in version 2.2 of Mongo. I tried to do

 brew upgrade mongodb

and I get

Error: mongodb already upgraded

Is there a way to install the latest version of Mongo with Homebrew?

Upvotes: 38

Views: 30915

Answers (5)

edouardbriere
edouardbriere

Reputation: 1260

This command should update your homebrew formulae to their latest version:

brew update

And then:

brew upgrade mongodb-community

To install the latest version of mongodb.

Upvotes: 67

kheengz
kheengz

Reputation: 1038

for MacOS Catalina and above

First, you install Homebrew. If you’re curious about what Homebrew is, read this article.

# Installs Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Second, find the MongoDB tap.

brew tap mongodb/brew

Third, install MongoDB.

brew install mongodb-community

Upvotes: 11

stromyc
stromyc

Reputation: 659

I tried the above solutions, but none of them worked. I got the error message:
no available formula or cask with the name "mongodb". Did you mean mongosh or monetdb? . I found a solution at this link.

Stackoverflow solution for No available formula or cask"

Upvotes: 0

Long_Live_King
Long_Live_King

Reputation: 1

You should be able to run: brew upgrade mongodb

now and it'll update prior to upgrading your version of mongodb.

Upvotes: 0

karthiks
karthiks

Reputation: 7299

If the version of mongodb in your brew receipe is the same of the version installed, you get the stated error.

Typically when you see a latest stable version released and you wish to bump up your mongodb version to it, you'd first have to update your brew receipe and then do your upgrade as you did.

That means you'd first do

brew update

and then

brew upgrade mongodb

Upvotes: 82

Related Questions