Skip to content

Instantly share code, notes, and snippets.

@hellysmile
Created November 13, 2016 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hellysmile/94b867052db114d90186d9cdb28e496d to your computer and use it in GitHub Desktop.
Save hellysmile/94b867052db114d90186d9cdb28e496d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
log() { echo -e "\e[0;33m${1}\e[0m"; }
# Ask for the administrator password upfront.
sudo -v
log 'Empty the Trash on all mounted volumes and the main HDD...'
sudo rm -rfv /Volumes/*/.Trashes
sudo rm -rfv ~/.Trash
log 'Clear System Log Files...'
sudo rm -rfv /private/var/log/asl/*.asl
sudo rm -rfv /Library/Logs/DiagnosticReports/*
sudo rm -rfv /Library/Logs/Adobe/*
rm -rfv ~/Library/Containers/com.apple.mail/Data/Library/Logs/Mail/*
rm -rfv ~/Library/Logs/CoreSimulator/*
log 'Cleanup iOS Applications...'
rm -rfv ~/Music/iTunes/iTunes\ Media/Mobile\ Applications/*
log 'Remove iOS Device Backups...'
rm -rfv ~/Library/Application\ Support/MobileSync/Backup/*
log 'Remove iOS Software Updates...'
rm -rfv ~/Library/iTunes/iPhone\ Software\ Updates/*
log 'Cleanup XCode Derived Data and Archives...'
rm -rfv ~/Library/Developer/Xcode/DerivedData/*
rm -rfv ~/Library/Developer/Xcode/Archives/*
log 'Cleanup Homebrew Cache...'
brew cleanup --force -s
rm -rfv $(brew --cache)/*
brew tap --repair
# Revoke sudo access again.
sudo -k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment