Skip to content

Xalior/zsh-brew-outdated

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍺 zsh-brew-outdated

An oh-my-zsh plugin that shows you how many outdated Homebrew packages you have β€” right in your terminal MOTD.

Uses a stale-while-revalidate cache so your prompt is never blocked ⚑ The heavy brew update && brew outdated runs in the background; the display is an instant file read.

✨ Features

  • πŸš€ Zero-delay login β€” reads from cache, refreshes in background
  • πŸ”„ Stale-while-revalidate β€” always shows something, updates behind the scenes
  • πŸ“¦ First-run sync β€” no cache yet? Fetches synchronously so you always get output
  • ⏱️ Configurable TTL β€” default 3 hours, set whatever you like
  • πŸ–₯️ Cross-platform β€” works on macOS and Linux
  • πŸ“‹ Verbose mode β€” optionally list the outdated package names

πŸ“₯ Installation

oh-my-zsh

Clone into your custom plugins directory:

git clone https://github.com/xalior/zsh-brew-outdated.git \
  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/brew-outdated

Then add brew-outdated to your plugin list in ~/.zshrc:

plugins=(... brew-outdated)

zinit

zinit light xalior/zsh-brew-outdated

antigen

antigen bundle xalior/zsh-brew-outdated

βš™οΈ Configuration

Set these before oh-my-zsh is loaded in your ~/.zshrc:

Variable Default Description
BREW_OUTDATED_CACHE_TTL 10800 Max cache age in seconds (default: 3 hours)
BREW_OUTDATED_CACHE_FILE ~/.cache/brew-outdated Path to the cache file
BREW_OUTDATED_VERBOSE false If true, list outdated package names

Example:

BREW_OUTDATED_CACHE_TTL=7200      # refresh every 2 hours
BREW_OUTDATED_VERBOSE=true         # show package names
plugins=(... brew-outdated)
source $ZSH/oh-my-zsh.sh

πŸ–₯️ Output

Default:

7 outdated Homebrew package(s)

Verbose (BREW_OUTDATED_VERBOSE=true):

7 outdated Homebrew package(s)
ffmpeg
git
node
[email protected]
ripgrep
sqlite
wget

πŸ”§ How it works

  1. Plugin registers a precmd hook so output appears after your other MOTD (neofetch, fastfetch, etc.)
  2. Checks the cache file's age against the TTL
  3. If stale, spawns a background job to run brew update && brew outdated πŸ”„
  4. If no cache exists at all, fetches synchronously so you always see output on first run
  5. Displays from cache instantly β€” zero prompt delay ⚑

πŸš€ Optional: Background Updates with brew autoupdate

The plugin refreshes its cache when you open a shell, but Homebrew's own autoupdate tap can keep your formulae database fresh in the background via launchd β€” even when you haven't opened a terminal in a while.

brew tap homebrew/autoupdate
brew autoupdate start 43200 --cleanup   # every 12 hours

This pairs nicely with the plugin: brew autoupdate keeps brew update running on a schedule, so when the plugin checks brew outdated the results are already up to date β€” making the background refresh even faster. ⚑

Without brew autoupdate, the plugin handles everything on its own β€” it just means the background refresh includes a brew update which takes a few seconds longer.

πŸ“‹ Requirements

  • zsh + brew
  • Works with oh-my-zsh, zinit, antigen, or manual sourcing

πŸ“„ License

MIT β€” go wild 🀘

About

🍺 oh-my-zsh plugin β€” shows outdated Homebrew package count as a login MOTD

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages