To clear the Gradle cache on a Mac, stop the Gradle daemons with ./gradlew --stop, then delete ~/.gradle/caches. Old Gradle versions downloaded by project wrappers live in ~/.gradle/wrapper/dists and can be removed the same way. Keep ~/.gradle/gradle.properties and ~/.gradle/init.d, which hold your settings and are not cache. The next build downloads what it needs again.
Here is what each folder in ~/.gradle does, the commands to measure and clear them, and how the Android side fits in.
What is inside ~/.gradle
Gradle keeps one user home folder for every project on your Mac. Open it with Shift-Command-G in Finder and enter ~/.gradle, or list it in Terminal:
ls -la ~/.gradle
The usual contents:
- caches: downloaded dependency JARs and POMs, transformed artifacts (for Android, dexed and desugared libraries), compiled build scripts, and the build cache if you have it turned on. This is normally the biggest folder.
- wrapper/dists: a full Gradle distribution for each version a project's
gradle-wrapper.propertiesasked for. Every Gradle upgrade across your projects adds another one. - daemon: log files from Gradle daemons, one folder per Gradle version.
- native: small native libraries Gradle extracts for file watching and similar features.
- jdks: JDKs that Gradle's toolchain support downloaded automatically, if you use that feature.
- gradle.properties: your personal settings, such as JVM arguments, proxy settings and sometimes signing or repository credentials. Not cache.
- init.d: init scripts that apply to every build. Not cache.
The rule is simple: folders are rebuildable, the two settings items are yours.
Step 1: measure
du -sh ~/.gradle
du -sh ~/.gradle/caches ~/.gradle/wrapper/dists ~/.gradle/daemon 2>/dev/null
# Which Gradle versions are taking space
du -sh ~/.gradle/wrapper/dists/* 2>/dev/null | sort -h
du -sh ~/.gradle/caches/* 2>/dev/null | sort -h
Inside caches you will see version-numbered folders such as 8.10 or transforms-3, plus modules-2, which holds downloaded dependencies shared across Gradle versions. Folders numbered for Gradle versions you no longer use are a good target if you want to be selective.
Recent Gradle versions remove unused cache entries on their own over time, so the folder does not grow without limit. But wrapper distributions and per-version folders from old Gradle releases tend to stay until you remove them.
Step 2: stop the daemons
Gradle runs long-lived daemon processes that keep files in ~/.gradle open. Deleting the cache under a running daemon can produce odd build failures until the daemon restarts. From any Gradle project:
./gradlew --stop
If you have a system-wide Gradle install, gradle --stop does the same. Each Gradle version has its own daemons, and --stop only stops daemons of the version you run it with, so if you work on projects pinned to different Gradle versions, run it in each, or check for leftovers:
jps -l | grep -i gradle
Also quit Android Studio or IntelliJ IDEA, which start their own Gradle daemons for syncing.
Step 3: clear the caches
This deletes immediately and does not use the Trash.
rm -rf ~/.gradle/caches
To be more selective, remove only the per-version folders for old Gradle releases and leave the shared dependency cache in place, which avoids a full re-download:
# Example: remove folders for a Gradle version you no longer use
rm -rf ~/.gradle/caches/7.6
In Finder, the same works with Go to Folder: open ~/.gradle, select caches and choose File › Move to Trash. You may need Shift-Command-Period to see the hidden folder in other windows.
Step 4: remove old wrapper distributions
Each folder in ~/.gradle/wrapper/dists is named after a distribution, such as gradle-8.10.2-bin. Delete the ones no current project uses. To see which versions your projects ask for:
grep -h distributionUrl ~/Projects/*/gradle/wrapper/gradle-wrapper.properties 2>/dev/null | sort -u
Adjust ~/Projects to wherever you keep code. Then remove the others:
rm -rf ~/.gradle/wrapper/dists/gradle-7.6-bin
If you delete a version a project still needs, the wrapper downloads it again on the next ./gradlew run. Daemon logs in ~/.gradle/daemon can also be removed at any time with the daemons stopped.
What to expect on the next build
The first build after clearing caches re-resolves and downloads every dependency, recompiles build scripts and, for Android, re-runs artifact transforms. It needs a network connection and takes noticeably longer than usual; later builds return to normal. In Android Studio, a Gradle sync runs automatically and may show "Downloading" for a while.
If you work behind a corporate proxy or a private repository, make sure ~/.gradle/gradle.properties is still in place before you start, since that is often where those settings live.
Per-project build folders
The global cache is not the only Gradle-related space. Every module in every project has its own build directory with compiled classes, merged resources and, for Android, APKs and intermediate files. Running ./gradlew clean in a project removes them, and the next build recreates them. For old projects you no longer build, deleting the build folders (and the hidden .gradle folder inside the project, which holds project-level state) is just as safe as clearing the global cache.
Android Studio's other folders
When people search for "Android Studio taking up space on Mac", Gradle is only part of the answer. Other locations to check:
~/.android/avd: Android emulators and their disk images. Delete emulators you no longer use from Android Studio's Device Manager, not from Finder, so the IDE stays in sync.~/.android/cache: small downloaded metadata, safe to clear.~/Library/Android/sdk: the Android SDK, including system images and old platform and build-tools versions. Remove what you do not need from Settings › Languages & Frameworks › Android SDK (the SDK Manager) in Android Studio.~/Library/Caches/Google: the IDE's own caches. File › Invalidate Caches in Android Studio is the gentler way to reset them.- Folders from old Android Studio versions. Each version keeps its own settings, logs and caches in folders named after it:
~/Library/Application Support/Google/AndroidStudiofollowed by the version, and the matching folders in~/Library/Logs/Googleand~/Library/Caches/Google. Once the current version has imported your settings, the folders of older versions can go. List them withls ~/Library/Application\ Support/Google ~/Library/Logs/Google ~/Library/Caches/Google. CleanLoupe lists theCaches/Googlefolders among App caches, but it doesn't touch emulators, the SDK or Application Support, so the rest is manual.
Flutter projects use Gradle for their Android side, but they also fill the Dart pub cache and, for iOS, CocoaPods; clearing Flutter pub, CocoaPods, Cargo and Go caches covers those.
How CleanLoupe does it
The Developer group in CleanLoupe's Cleanup module shows the Gradle folders with sizes:
~/.gradle/cachesand~/.android/cache: labelled Safe.~/.gradle/wrapper/dists: labelled Review, because removing a distribution a project still uses means waiting for a re-download, so you decide which to keep.
Selected items move to the Trash and appear in History, where Put Back restores them until you empty the Trash. Anything written in the last hour is not preselected, so a build that just ran is left out by default. CleanLoupe never lists gradle.properties or init.d.
What it does not do: CleanLoupe does not stop Gradle daemons for you, so run ./gradlew --stop and quit Android Studio first. It does not remove Android emulators or SDK components; use Device Manager and the SDK Manager for those. Android Studio's caches in ~/Library/Caches/Google and IntelliJ's in ~/Library/Caches/JetBrains do show up among App caches, because they live in ~/Library/Caches, but Invalidate Caches is still the gentler route while you use the IDE. Settings and plugins in ~/Library/Application Support are not touched. The app is free, with no subscription or account.
JavaScript projects have their own equivalent folders; see clearing npm, Yarn and pnpm caches. For the complete list of developer folders on a Mac, see freeing up disk space on a developer Mac.
FAQ
Is it safe to delete ~/.gradle/caches?
Yes. Everything in it can be downloaded or regenerated, and Gradle rebuilds it on the next build. Stop the daemons first and keep gradle.properties and init.d, which live next to it but are not cache.
Where is the Gradle cache on a Mac?
In your home folder at ~/.gradle/caches. If the GRADLE_USER_HOME environment variable is set, Gradle uses that folder instead; check with echo $GRADLE_USER_HOME in Terminal.
Can I delete Gradle wrapper dists?
Yes. Each folder in ~/.gradle/wrapper/dists is a downloaded Gradle version. Delete versions no project uses; if one is still needed, the wrapper downloads it again on the next run.
Does cleaning the project in Android Studio clear the Gradle cache?
No. Build › Clean Project removes the project's own build folders. The shared cache in ~/.gradle/caches stays as it is.
To see the Gradle folders and their sizes in one list, download CleanLoupe.