Skip to content

Instantly share code, notes, and snippets.

@craigstjean
Created November 11, 2015 14:58
Show Gist options
  • Save craigstjean/95070431ffe85439dd98 to your computer and use it in GitHub Desktop.
Save craigstjean/95070431ffe85439dd98 to your computer and use it in GitHub Desktop.
Keep Homebrew updated once daily
# Assuming you open Terminal at least once a day, add this to your shell profile
# (I use zsh, you may require changes for your shell)
function brew_update() {
brew update
brew upgrade --all
}
CURR_DATE=`date '+%Y-%m-%d'`
LAST_DATE=`head -n 1 $HOME/.brew_update_date 2>/dev/null`
if [ "$CURR_DATE" != "$LAST_DATE" ]; then
echo $CURR_DATE > $HOME/.brew_update_date
echo Updating Homebrew...
brew_update
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment