How to upgrade Homebrew itself (not softwares/formulas installed by it) on macOS?

I have homebrew installed long before the OS is upgraded a few times to 10.12.3. Now that

$ brew --version
Homebrew 0.9.9 (git revision 080c; last commit 2016-08-11)
Homebrew/homebrew-core (git revision b163b; last commit 2016-08-10)

How to properly upgrade to newer version, say 1.1?

$ brew upgrade 

didn't work.


Solution 1:

To update homebrew itself, use:

brew update

To upgrade all packages installed using homebrew, then you have to use brew upgrade. You can check this FAQ from brew website for more details.

Solution 2:

The right way to solve this is to enter:

$ cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update

Found at http://discourse.brew.sh/t/how-to-upgrade-brew-stuck-on-0-9-9/33.

Solution 3:

As a habit, I run this command once a week:

brew update && brew upgrade && brew cleanup

It updates brew itself, casks and related packages then clears old package's unneeded files. Here is the result after running twice:

Already up-to-date

Solution 4:

When you want to update Homebrew, use brew update. After running brew update, you may have outdated formulae installed, which is where brew upgrade is necessary.

$ git -C
Takes an existing commit object, and reuses the log messages and the authorship information (including the timestamp) when creating a commit.

/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
This is the path to the homebrew-core folder on a computer.

fetch
Downloads objects and references from another repository.

--unshallow
This is a git fetch option. If the source repository is complete, it converts a shallow repository to a complete one, removing all the limitations imposed by shallow repositories.

brew update
Updates the Homebrew