Created
April 21, 2017 10:58
-
-
Save gotterdemarung/aec92a6da7cb2e8a23fb771d27578806 to your computer and use it in GitHub Desktop.
Script to clean caches and trash on MacOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use
ncdu
, Luke!How about PyCharm, RubyMine and tons of InteliiJ-based IDEs?