Skip to content
Black Friday · 25% off · Lifetime Pro for $5.99 $7.99Ends in …Code BLACKFRI25

How to Clear Gradle Cache on Mac

Android Studio, React Native and Flutter projects all share one Gradle home folder, and it never shrinks on its own fast enough. Every Gradle version you have ever used leaves a wrapper distribution, and every dependency version stays in the cache. Here is how to clear it safely.

Developer GuideBy Ojas PalorkarUpdated December 6, 20266 min readTested on macOS 15 Sequoia, Gradle 8 and 9, Android Studio

Quick answer

Stop the daemon with ./gradlew --stop, check sizes with du -sh ~/.gradle/* | sort -h, then delete ~/.gradle/caches and the old versions in ~/.gradle/wrapper/dists. Gradle downloads what it needs on the next build, which will be slower once. Typical savings: 5 to 40 GB.

Where the space goes

~/.gradle/cachesrm -rf ~/.gradle/caches
5–30 GBYes
~/.gradle/wrapper/distsrm -rf ~/.gradle/wrapper/dists/gradle-7*
1–10 GBOld versions
~/.gradle/daemon./gradlew --stop
100 MB–1 GBYes
<project>/build and <project>/.gradle./gradlew clean
0.5–5 GB eachYes
Typical sizes on a 0 to 30 GB scale. Your disk will differ.

Step 1: Stop the Gradle daemon

A running daemon keeps files in the cache open. Stop it first, from any Gradle project:

./gradlew --stop

Or run gradle --stop if Gradle is installed with Homebrew. Close Android Studio too.

Step 2: See what’s using the space

du -sh ~/.gradle/* 2>/dev/null | sort -h
du -sh ~/.gradle/caches/* ~/.gradle/wrapper/dists/* 2>/dev/null | sort -h

caches is usually the biggest folder. wrapper/dists has one folder per Gradle version you’ve used.

Step 3: Delete the caches

To clear only the build cache and keep downloaded dependencies:

rm -rf ~/.gradle/caches/build-cache-1

To clear everything Gradle has cached:

rm -rf ~/.gradle/caches
Don’t delete ~/.gradle/gradle.properties or ~/.gradle/init.d. They hold your settings and signing configuration, not cache.

Step 4: Remove old Gradle versions

List the wrapper distributions, then delete the versions your projects no longer use:

ls ~/.gradle/wrapper/dists
rm -rf ~/.gradle/wrapper/dists/gradle-7.6-bin

A project that still needs that version will download it again on its next build.

Step 5: Clean old project builds

Each project also keeps a build folder per module and a .gradle folder. Run this in projects you’re not actively working on:

./gradlew clean

For emulator images and the Android SDK, see Android Emulator disk space on Mac.

Clear Gradle and other build caches with SpaceWise

SpaceWise scans Xcode, Docker, node_modules, Gradle, Homebrew, package manager caches and local AI models, groups them by project, checks git status and lockfiles before it suggests anything, and moves what you approve to the Trash so you can undo it. The scan is free on Mac and Windows.

Find your Gradle and Android caches

Run a free scan to see Gradle caches, wrapper versions and other build caches with their sizes.

Download for Mac

FAQ

Is it safe to delete the Gradle cache?

Yes. ~/.gradle/caches only holds downloaded dependencies and build outputs that Gradle can recreate. Stop the daemon first, and expect the next build to take longer while dependencies download again.

Where is the Gradle cache on Mac?

In your Gradle user home, ~/.gradle by default (/Users/<you>/.gradle). Dependencies are in ~/.gradle/caches/modules-2, the build cache in ~/.gradle/caches/build-cache-1, and Gradle versions in ~/.gradle/wrapper/dists. The GRADLE_USER_HOME variable can move it.

Does Invalidate Caches in Android Studio clear the Gradle cache?

No. File > Invalidate Caches clears Android Studio's own IDE caches and indexes. The Gradle cache in ~/.gradle stays until you delete it.

How do I clear the Gradle cache for React Native or Flutter?

Run ./gradlew clean inside the android folder to remove the project build, then delete ~/.gradle/caches for the shared cache. Flutter also has flutter clean for its own build folder.

Does Gradle clean its cache automatically?

Partly. Recent Gradle versions remove cache entries that haven't been used for a while, and the retention period can be changed with an init script. Old wrapper distributions and very active caches still grow, so a manual clean helps.

Run this cleanup in SpaceWise

Same targets, Recovery Bin rollback, no Terminal required. Free tier included.

Download for Mac