From 9b72aea5147834c3e160756de83d2deda4bb745b Mon Sep 17 00:00:00 2001 From: "Max W." Date: Tue, 6 May 2025 10:51:59 +0000 Subject: [PATCH] Add homebrewMaintenance.sh --- homebrewMaintenance.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 homebrewMaintenance.sh diff --git a/homebrewMaintenance.sh b/homebrewMaintenance.sh new file mode 100644 index 0000000..8effe0f --- /dev/null +++ b/homebrewMaintenance.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# homebrew-maintenance.sh - Script to perform routine Homebrew maintenance tasks + +# Set script to exit on error +set -e + +# Set terminal colors for better readability +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +echo -e "${YELLOW}Starting Homebrew maintenance...${NC}" + +# Check if Homebrew is installed +if ! command -v brew &> /dev/null; then + echo "Homebrew is not installed. Exiting." + exit 1 +fi + +# Update Homebrew itself +echo -e "${YELLOW}Updating Homebrew...${NC}" +brew update + +# Upgrade all installed formulae and casks +echo -e "${YELLOW}Upgrading packages and applications...${NC}" +brew upgrade + +# Remove orphaned dependencies +echo -e "${YELLOW}Removing unused dependencies...${NC}" +brew autoremove + +# Clean up old versions and cache +echo -e "${YELLOW}Cleaning up old versions and cache...${NC}" +brew cleanup + +echo -e "${GREEN}Homebrew maintenance completed successfully!${NC}" \ No newline at end of file