How do I tell Homebrew to stop running brew update every time I want to install something?

Homebrew started running brew update automatically before every brew install. This means that I need to wait 10-20 seconds, depending on network speed, every time I want to install a package. This is tedious and unnecessary.

How can I opt out from this behavior, or set it to something saner?

5 Answers

Just prefix your install command with HOMEBREW_NO_AUTO_UPDATE=1, like this:

HOMEBREW_NO_AUTO_UPDATE=1 brew install somepackage

Source: brew manpage

I just modified /usr/local/bin/brew to add HOMEBREW_NO_AUTO_UPDATE=1 (according to @D Schlachter answer) at the start of the file

3

I personally find pinning/unpinning formulas more useful. For example you install a tool depends on 100 libraries which you don't use.

brew deps someprogram | xargs brew pin

Then you can check your pinned formulas anytime. If you have any problems with the version just unpin.

Not recommended to everyone, to pin all the formulas and manage updates manually:

brew list | xargs brew pin
1

To have brew automatically run brew update AFTER installing, I added the following to my bash/zsh environment:

function brew2() { HOMEBREW_NO_AUTO_UPDATE=1 brew "$@" && brew update
}

Then to install package x, I do brew2 x, for example brew2 cask install spotmenu. Seems to work.

2

I recommend installing homebrew-autoupdate. Run: brew tap homebrew/autoupdate

This is a script that will automatically run brew update in the background once every 24 hours, or on system boot. Then you can add this line to your ~/.bashrc (or ~/.zshrc) to disable the built-in autoupdate mechanism:

export HOMEBREW_NO_AUTO_UPDATE="1"

You can also configure it to run more frequently in the background, for example every 12 hours (43200 seconds):

brew autoupdate start 43200
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like