ma11hew28
ma11hew28

Reputation: 126547

How do I update a formula with Homebrew?

How do I update a formula?

I ran brew update. However, mongodb is still outdated according to brew outdated:

mongodb (1.4.3-x86_64 < 1.6.5-x86_64)

Upvotes: 322

Views: 301628

Answers (6)

y.c
y.c

Reputation: 5783

First, update brew's internal list of formulae to the latest:

brew update

To upgrade only the mongodb formula, use install:

brew install mongodb

To upgrade all outdated formulae:

brew upgrade

Upvotes: 520

Jonathan Komar
Jonathan Komar

Reputation: 3096

I prefer to upgrade all homebrew formulae and homebrew cask formulae.

I added a Bourne shell function to my environment for this one (I load a .bashrc)

function updatebrew() {
set -x;
brew update;
brew cleanup;
brew cask upgrade --greedy
)
}
  • set -x for transparency: So that the terminal outputs whatever Homebrew is doing in the background.
  • brew update to update homebrew formulas
  • brew cleanup to remove any change left over after installations
  • brew cask upgrade --greedy will install all casks; both those with versioning information and those without

Upvotes: -2

webcpu
webcpu

Reputation: 3432

You can't use brew install to upgrade an installed formula. If you want upgrade all of outdated formulas, you can use the command below.

brew outdated | xargs brew upgrade

Upvotes: 4

Joseph
Joseph

Reputation: 6032

You will first need to update the local formulas by doing

brew update

and then upgrade the package by doing

brew upgrade formula-name

An example would be if i wanted to upgrade mongodb, i would do something like this, assuming mongodb was already installed :

brew update && brew upgrade mongodb && brew cleanup mongodb

Upvotes: 51

user689741
user689741

Reputation: 865

You can update all outdated packages like so:

brew install `brew outdated`

or

brew outdated | xargs brew install

or

brew upgrade

This is from the brew site..

for upgrading individual formula:

brew install formula-name && brew cleanup formula-name

Upvotes: 84

ma11hew28
ma11hew28

Reputation: 126547

Well, I just did

brew install mongodb

and followed the instructions that were output to the STDOUT after it finished installing, and that seems to have worked just fine. I guess it kinda works just like make install and overwrites (upgrades) a previous install.

Upvotes: 16

Related Questions