Skip to content

Instantly share code, notes, and snippets.

@gotterdemarung
Created April 21, 2017 10:58
Show Gist options
  • Save gotterdemarung/aec92a6da7cb2e8a23fb771d27578806 to your computer and use it in GitHub Desktop.
Save gotterdemarung/aec92a6da7cb2e8a23fb771d27578806 to your computer and use it in GitHub Desktop.
Script to clean caches and trash on MacOS
#!/bin/bash
CACHES=~/Library/Caches
echo -e "πŸ”” \033[0;33mCurrent disk usage\033[0m"
df -h
echo -e "πŸ”” \033[0;33mCaches folder $CACHES\033[0m"
echo -e "πŸ”” \033[0;33mRemoving brew caches\033[0m"
#brew cleanup
if [ -d "$CACHES/Google/Chrome" ]; then
echo -e "πŸ”” \033[0;33mRemoving Google Chrome cache\033[0m"
rm -rf "$CACHES/Google/Chrome"
else
echo -e "πŸ”” \033[0;33mGoogle Chrome cache not found or empty\033[0m"
fi
if [ -d "$CACHES/com.apple.Safari/WebKitCache" ]; then
echo -e "πŸ”” \033[0;33mRemoving Safari WebKit cache\033[0m"
rm -rf "$CACHES/com.apple.Safari/WebKitCache"
else
echo -e "πŸ”” \033[0;33mSafari WebKit cache not found or empty\033[0m"
fi
for dir in $CACHES/IdeaIC*
do
if [ -d $dir ]; then
echo -e "πŸ”” \033[0;33mRemoving $dir cache\033[0m"
rm -rf $dir
fi
done
for dir in $CACHES/PhpStorm*
do
if [ -d $dir ]; then
echo -e "πŸ”” \033[0;33mRemoving $dir cache\033[0m"
rm -rf $dir
fi
done
echo -e "πŸ”” \033[0;32mCurrent disk usage\033[0m"
df -h
@rozhok
Copy link

rozhok commented Apr 21, 2017

Use ncdu, Luke!

PhpStorm*

How about PyCharm, RubyMine and tons of InteliiJ-based IDEs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment