How to Update Homebrew on Mac
Want to update Homebrew and your packages? Of course you do! Homebrew is a popular package manager for Mac that easily allows users to install and manage command line tools, apps, and utilities, typically familiar with the Linux and Unix world. Because it’s a package manager, you won’t need to manually build anything from source either. Of course like any other software, Homebrew itself along with the command line tools get updated, so you might be wondering how to update Homebrew, and how to upgrade Homebrew packages to newer versions.
We’ll cover the simple official way to update Homebrew itself, as well as packages, and we’ll also discuss how to freeze packages at a particular version should you wish to not update those. We’ll also discuss a way to reinstall Homebrew if the standard update and upgrade process is not working for whatever reason.
How to Update Homebrew
Updating Homebrew is pretty straight forward:
This updates homebrew itself.
You can then upgrade all individual packages and formula with the following:
If for whatever reason you’re experiencing issues with this approach, skip further down to update Homebrew by reinstalling the package manager.
Prevent Updating of Specific Homebrew Formula
If you want to avoid updating certain formula you can use the following brew command to keep the version at present:
brew pin [name]
And of course you can unpin the formula to have it be updated again:
brew unpin [formula]
Updating by Reinstalling Homebrew
Keep in mind that by uninstalling Homebrew and then reinstalling Homnebrew, you will lose packages and formula you have already installed, and would need to install those again.
First, uninstall Homebrew by using the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Once the uninstall procedure is complete, you can simply install Homebrew again, this effectively reinstalls the entire package manager. (Optionally you might want to reboot the Mac in between to delete temporary items and other system caches but this should not be necessary).
Next, reinstall Homebrew with the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Let that complete, and you’ll have the latest version of Homebrew installed on the Mac.
Again, by uninstalling and then reinstalling Homebrew you will need to install individual packages and formula again, so don’t forget to do that.
Don’t forget that Homebrew has a ton of official documentation too if you need additional insight.