Add homebrewMaintenance.sh
This commit is contained in:
commit
9b72aea514
37
homebrewMaintenance.sh
Normal file
37
homebrewMaintenance.sh
Normal file
@ -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}"
|
Loading…
x
Reference in New Issue
Block a user