brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: HOMEBREW_AUTO_UPDATE_SECS stops brew install from updating every time

Terminal
~/tips/tip-macos-homebrew-auto-update-secs

export HOMEBREW_AUTO_UPDATE_SECS=604800

Sets how often Homebrew updates itself before install and upgrade commands.

You type brew install jq because you want jq, and Homebrew first goes off to update itself. That’s by design, and I’d rather tune it than switch it off completely.

Before commands like brew install, brew upgrade and brew tap, Homebrew runs brew update when the last update is older than HOMEBREW_AUTO_UPDATE_SECS. The default is 86400 seconds, so once a day. It drops to an hour if you have run a developer command. If once a week feels fine to you, put this in ~/.zprofile:

export HOMEBREW_AUTO_UPDATE_SECS=604800

Open a new tab and the slower rhythm applies. You can still run brew update yourself whenever you like.

There is also a hard off switch, and it works nicely for a single command when you are in a hurry:

HOMEBREW_NO_AUTO_UPDATE=1 brew install jq

My advice is to keep that one for exceptions and not export it permanently. The Homebrew manual itself prefers that you update less often through HOMEBREW_AUTO_UPDATE_SECS instead. It warns that with auto-update off, things like tapping new taps can leave you with a broken configuration, and it asks you to always run brew update before reporting an issue. A stale Homebrew also means you keep installing older versions without noticing, which is the opposite of what most people want from a package manager.

Further reading: Homebrew manpage

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link