Skip to content

Instantly share code, notes, and snippets.

@askucher
Last active September 27, 2019 16:58
Show Gist options
  • Save askucher/f21f62c226d017fb8905e7cd5dcfe12b to your computer and use it in GitHub Desktop.
Save askucher/f21f62c226d017fb8905e7cd5dcfe12b to your computer and use it in GitHub Desktop.
#Taking out the trash.
printf "Emptying the trash.\n"
sudo rm -rfv /Volumes/*/.Trashes > /dev/null 2>&1
sudo rm -rfv ~/.Trash > /dev/null 2>&1
sudo rm -rfv ~/Library/Logs > /dev/null 2>&1
#Clean the logs.
printf "Emptying the system log files.\n"
sudo rm -rfv /private/var/log/* > /dev/null 2>&1
sudo rm -rfv /Library/Logs/DiagnosticReports/* > /dev/null 2>&1
#Cleaning Up Homebrew.
printf "Cleaning up Homebrew.\n"
brew cleanup --force -s > /dev/null 2>&1
brew cask cleanup > /dev/null 2>&1
rm -rfv /Library/Caches/Homebrew/* > /dev/null 2>&1
brew tap --repair > /dev/null 2>&1
brew update > /dev/null 2>&1
brew upgrade > /dev/null 2>&1
#Purging Memory.
printf "Purging memory.\n"
sudo purge > /dev/null 2>&1
#Securly Erasing Data.
printf "Securely erasing free space (This will take a while). \n"
diskutil secureErase freespace 0 "$( df -h / | tail -n 1 | awk '{print $1}')" > /dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment