If you want to remove Android Studio from your macOS system completely, you can follow these steps to ensure that all application files, settings, and caches are deleted. Use the following commands in Terminal to achieve this:
Step 1: Remove the Android Studio Application
The first step is to delete the Android Studio application itself from your Applications folder. You can do this by using the following command:
rm -Rf /Applications/Android\ Studio.app
This command will remove the Android Studio app entirely from the /Applications directory.
Step 2: Delete Associated Files and Preferences
Android Studio stores various settings, configurations, logs, and caches in different directories. To fully uninstall Android Studio, you must remove these files as well.
Remove Preferences and Configuration Files:
rm -Rf ~/Library/Preferences/AndroidStudio*
rm -Rf ~/Library/Preferences/com.google.android.*
rm -Rf ~/Library/Preferences/com.android.*
Remove Application Support Files:
rm -Rf ~/Library/Application\ Support/AndroidStudio*
Remove Logs:
rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Logs/Google/AndroidStudio*
Remove Caches:
rm -Rf ~/Library/Caches/AndroidStudio*
Remove Global Settings:
rm -Rf ~/.AndroidStudio*
Step 3: Remove Gradle and Android SDK
Android Studio installs the Gradle build system and the Android SDK, which are used to compile and build Android apps. These files also need to be removed.
Remove Gradle:
rm -Rf ~/.gradle
Remove Android SDK:
rm -Rf ~/.android
rm -Rf ~/Library/Android*
rm -Rf /usr/local/var/lib/android-sdk/
Conclusion
After running all these commands, Android Studio and all related files should be completely removed from your macOS system. If needed, You can reinstall a fresh copy of Android Studio or free up system resources by eliminating any leftover files.
Be cautious when using rm -Rf as it permanently deletes files. Double-check the directories to ensure you’re removing the correct items.