Skip to content

Instantly share code, notes, and snippets.

@mtavkhelidze
Forked from tahmidsadik/purgeAndroid.txt
Last active October 25, 2017 06:40
Show Gist options
  • Save mtavkhelidze/542144dcfca6dafba2307021942e03c4 to your computer and use it in GitHub Desktop.
Save mtavkhelidze/542144dcfca6dafba2307021942e03c4 to your computer and use it in GitHub Desktop.
How to completely remove Android Studio from Mac OS X
#!/usr/bin/env bash
# Remove Android Studio from your macOs
dry_run=true
while getopts "f" opt; do
case $opt in
f)
dry_run=false
echo "Removing..."
echo "Warning! This action is irreversible."
;;
*)
echo "Run with -f to force removal."
echo "Run without options to see what will be removed."
exit 1;
;;
esac
done
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
declare -a removables=(
/Applications/Android\ Studio.app
~/Library/Preferences/AndroidStudio*
~/Library/Preferences/com.google.android.studio.plist
~/Library/Application\ Support/AndroidStudio*
~/Library/Logs/AndroidStudio*
~/Library/Caches/AndroidStudio*
~/AndroidStudioProjects
~/.gradle
~/.android
~/Library/Android*
~/.android
)
if [ $dry_run = true ]; then
echo "These items will be removed:"
fi
for r in ${removables[@]}; do
if [ $dry_run = true ]; then
echo -e "\t$r"
else
echo "$r"
rm -fr "$r"
fi
done
IFS=$SAVEIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment