Skip to content

Instantly share code, notes, and snippets.

@duykhoa
Last active March 7, 2016 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duykhoa/6b04c0ade84a8dac008d to your computer and use it in GitHub Desktop.
Save duykhoa/6b04c0ade84a8dac008d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Ask for the administrator password upfront
echo 'Please enter your password to grant sudo-rights:'
sudo -v
echo 'Empty the Trash on all mounted volumes and the main HDD...'
sudo rm -rfv /Volumes/*/.Trashes &>/dev/null
sudo rm -rfv ~/.Trash &>/dev/null
echo 'Clear System Log Files...'
sudo rm -rfv /private/var/log/asl/*.asl &>/dev/null
sudo rm -rfv /Library/Logs/DiagnosticReports/* &>/dev/null
sudo rm -rfv /Library/Logs/Adobe/* &>/dev/null
rm -rfv ~/Library/Containers/com.apple.mail/Data/Library/Logs/Mail/* &>/dev/null
rm -rfv ~/Library/Logs/CoreSimulator/* &>/dev/null
/
echo 'Clear Adobe Cache Files...'
sudo rm -rfv ~/Library/Application\ Support/Adobe/Common/Media\ Cache\ Files/* &>/dev/null
echo 'Cleanup iOS Applications...'
rm -rfv ~/Music/iTunes/iTunes\ Media/Mobile\ Applications/* &>/dev/null
echo 'Remove iOS Device Backups...'
rm -rfv ~/Library/Application\ Support/MobileSync/Backup/* &>/dev/null
echo 'Cleanup XCode Derived Data and Archives...'
rm -rfv ~/Library/Developer/Xcode/DerivedData/* &>/dev/null
rm -rfv ~/Library/Developer/Xcode/Archives/* &>/dev/null
echo 'Cleanup Homebrew Cache...'
brew cleanup --force -s &>/dev/null
rm -rfv /Library/Caches/Homebrew/* &>/dev/null
brew tap --repair &>/dev/null
echo 'Cleanup Screenshot'
rm -rf ~/Desktop/Screen\ Shot*
rm -rf ~/Downloads/*.zip ~/Downloads/*.gif ~/Downloads/*.jpg ~/Downloads/*.dmg
~/Downloads/*.png
clear && echo 'Everything is cleaned up :3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment