Skip to content

Instantly share code, notes, and snippets.

@Spazholio
Created December 6, 2024 22:40
Show Gist options
  • Save Spazholio/3478d253f64020b28c237caee61ea288 to your computer and use it in GitHub Desktop.
Save Spazholio/3478d253f64020b28c237caee61ea288 to your computer and use it in GitHub Desktop.
Homebrew maintenance script
#!/bin/zsh
# Make sure we’re using the latest Homebrew
echo -e "### START UPDATING BREW ###\n"
brew update
echo -e "### FINISH UPDATING BREW ###\n"
# Upgrade any already-installed formulae
echo -e "### START UPDATING ALL FORMULAE ###\n"
brew upgrade
echo -e "### FINISH UPDATING ALL FORMULAE ###\n"
# Scrub the cache
echo -e "### START CLEANUP ###\n"
brew cleanup -s
echo -e "### FINISH CLEANUP ###\n"
echo -e "### START DOCTOR ###\n"
brew doctor
echo -e "### FINISH DOCTOR ###\n"
echo -e "### START LISTING OUTDATED CASKS ###\n"
brew outdated --cask
echo -e "### FINISH LISTING OUTDATED CASKS ###\n"
echo -e "### START UPDATING OUTDATED CASKS ###\n"
brew outdated --cask | xargs brew reinstall
echo -e "### FINISH UPDATING OUTDATED CASKS ###\n"
echo -e "### START LISTING UNNEEDED DEPENDENCIES (dry-run) - 'brew autoremove' to execute ###\n"
brew autoremove -n
echo -e "### FINISH LISTING UNNEEDED DEPENDENCIES (dry-run) ###\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment