简体   繁体   中英

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?

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

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

brew update

And then:

brew upgrade mongodb

To install the latest version of mongodb.

for MacOS Catalina

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

You should be able to run: brew upgrade mongodb

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

您只需要运行以下命令即可将 MongoDB 更新到最新版本:

$ brew update && brew upgrade mongodb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM