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

21,777

Solution 1

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

HOMEBREW_NO_AUTO_UPDATE=1 brew install somepackage

Source: brew manpage

Solution 2

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

Solution 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

Solution 4

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.

Share:
21,777

Related videos on Youtube

zool
Author by

zool

Broad technologist/generalist working in arts and culture. Interested in design, typography, statistic, music, and human language. Background in sociology and economics. Serial upvoter. “Never use computers, computers are terrible, always avoid computers.” —Ethan Marcotte “Incurious people terrify me.” —Coda Hale

Updated on September 18, 2022

Comments

  • zool
    zool over 1 year

    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?

  • cpcallen
    cpcallen over 4 years
    Why not just add export HOMEBREW_NO_AUTO_UPDATE=1 to your .bashrc?
  • Rob
    Rob over 4 years
    this and/or @cpcallen's comment above should be marked as the correct answer.
  • philraj
    philraj almost 4 years
    What does this have to do with homebrew updating itself?
  • Dominik Szymański
    Dominik Szymański over 3 years
    Why want homebrew to update everything before or after install at all? "If something is working, don't fix it", yet brew is doing it. Why would it be updating mitmproxy when I only want to install mysql-client?
  • Simon Alford
    Simon Alford over 3 years
    The best thing to do, imo, would be to auto-update everything in the background, the way apps autoupdate on phones nowadays. Something like this: apple.stackexchange.com/a/206474/308005
  • applecrusher
    applecrusher almost 3 years
    Why is this not the default setting? Who says, let me install something and while I am at it upgrade the other 50 things (because that certainly won't break anything)