Developers · Gradle
How to clear the Gradle cache on a Mac
Stop Gradle with ./gradlew --stop and quit Android Studio, then move ~/.gradle/caches, and ~/.gradle/wrapper/dists if you like, to the Trash. Both are safe to delete: the next build downloads what it needs again and is slower once. Don't delete the whole ~/.gradle folder. It also holds your own gradle.properties and init scripts, which nothing puts back.
Where the Gradle cache is
Gradle keeps everything it downloads in its user home, ~/.gradle, unless you have set GRADLE_USER_HOME somewhere else. Android Studio builds with Gradle too, so this is where an Android project's dependencies end up. To see what is taking the space:
du -sh ~/.gradle/* 2>/dev/null | sort -hWhat the folders are, from Gradle's own documentation:
caches: downloaded dependencies and the caches each Gradle version keeps. Usually the big one. Safe to delete.wrapper/dists: the Gradle versions the wrapper (./gradlew) downloaded, one per version your projects use. Safe to delete; each comes back the next time a project asks for it.daemon: the background Gradle processes' registry and logs. Gradle deletes logs older than 14 days itself.jdks: Java versions Gradle downloaded for builds that ask for one. Leave it unless you know your builds will fetch them again.gradle.propertiesandinit.d: your own settings and scripts. Keep them. Nothing downloads them again.
Gradle already cleans up after itself
About once a day, when a Gradle daemon stops, Gradle deletes caches for versions you haven't used in 30 days, wrapper downloads nothing uses, daemon logs older than 14 days, and shared cache entries unused for a week or a month, depending on whether they can be rebuilt on your Mac or have to be downloaded. Its documentation says these folders usually need no managing by hand. So a large caches folder is mostly what your projects have used in the last month. Clearing it gets the space back now, and it fills again as you build.
Clear it
- Stop Gradle. Quit Android Studio, then in each project you have built recently, run:
That stops the daemons started by that project's Gradle version only, so run it in a project for each version. Daemons left idle also stop by themselves after three hours../gradlew --stop - Move the caches to the Trash. On macOS 15 or later:
Or, in Finder, choose Go → Go to Folder, typetrash ~/.gradle/caches ~/.gradle/wrapper/dists~/.gradleand drag the two folders to the Trash. - Build once to check all is well, then empty the Trash. Nothing is freed until you do.
What it costs
- A slower first build in every project, while Gradle downloads its dependencies, and its own distribution, again.
- A network connection for that build. Gradle's documentation is clear that an
--offlinebuild fails if a module it needs is not in the cache. - Nothing else. Your projects, their source and your settings are not in these folders.
One thing that is not a way to clear it: --refresh-dependencies. Gradle's documentation says it checks the cached files again but does not download ones that are unchanged, and it frees no space.
Android emulators are elsewhere
If Android Studio is what filled the disk, the Gradle cache may not be the biggest part. Each emulator is a disk image in ~/.android/avd:
du -sh ~/.android/avd/* 2>/dev/null | sort -hDelete the ones you no longer use from Android Studio's Device Manager rather than in Finder, so Android Studio's list stays right. An emulator's apps and data go with it.
Where the app comes in
In the download edition, RefreshYourMac measures Gradle Caches: exactly ~/.gradle/caches and ~/.gradle/wrapper/dists, so your gradle.properties, init scripts and downloaded Java versions are never part of it. It is rated Safe for auto removal, and the app says plainly that the next Android build will be slower. Android emulators, emulator system images and each installed NDK version are separate rows, rated Review before deleting, because each costs a download or a lost emulator to get back. None of these are in the Mac App Store edition. For the rest of what development tools leave, see the Mac cleaner for developers.
What to do next: see these numbers for your own Mac. Download RefreshYourMac free, or get it on the Mac App Store.
What it costs to have an app do this
| RefreshYourMac | CleanMyMac | MacKeeper | |
|---|---|---|---|
| Pay once | $24.99 | €119.95 on MacPaw’s store; $89.99 for CleanMyMac X on the Mac App Store | subscription only |
| Yearly | $14.99 a year, first 7 days free | $39.99/yr on the Mac App Store; €39.95/yr on MacPaw’s store | €71.40 for the first year, 1 Mac. Their page shows it against a €119.40 list price |
| Monthly | $1.99 a month | $9.99/mo | €10.95/mo |
| Account needed | No | Yes | Yes |
Before you pay anything, both versions give you 3 free scans. CleanMyMac and MacKeeper prices read from their own pages and the Mac App Store on 27 October 2026; the full comparison is at RefreshYourMac vs CleanMyMac and MacKeeper.
Frequently asked questions
Is it safe to delete ~/.gradle/caches?
Yes. It holds downloaded dependencies and the caches each Gradle version keeps. Stop Gradle first with ./gradlew --stop and quit Android Studio. The next build downloads what it needs again and is slower once.
Can I delete the whole .gradle folder?
It is better not to. Besides the caches, ~/.gradle holds your own gradle.properties and init scripts, which nothing downloads again. Delete ~/.gradle/caches, and ~/.gradle/wrapper/dists if you like, and leave the rest.
Does Gradle clean its cache by itself?
Yes, about once a day when a daemon stops: caches for Gradle versions unused for 30 days, wrapper downloads nothing uses and daemon logs older than 14 days. So a large cache is mostly what your projects used in the last month.