Where apps hide your files
Gradle puts nearly everything it downloads in one hidden folder, ~/.gradle, and it can grow to many gigabytes. This page shows the layout, how to move it and how to trim it without breaking builds.
~/.gradle
That is the Gradle user home, the default per Gradle's own documentation. The folder starts with a dot, so Finder hides it. Open it with Go > Go to Folder (⇧⌘G) and paste ~/.gradle, or from Terminal:
open ~/.gradle
Android Studio uses the same folder, because it runs Gradle underneath. There is no separate Android Studio copy to look for.
| Folder or file | What it holds |
|---|---|
caches/ | The on-disk caches that make repeat builds faster: downloaded dependencies, build cache, compiled scripts. This is usually the biggest folder. |
wrapper/dists/ | Gradle versions downloaded by the Gradle Wrapper (gradlew), one folder per version such as gradle-8.12-bin. |
jdks/ | JDKs that Gradle downloaded through toolchain support. |
daemon/ | The Gradle Daemon registry and its logs. |
init.d/ | Global init scripts, which can include cache-cleanup settings. |
gradle.properties | Your global Gradle settings. Treat it as a config file: it can hold signing passwords or tokens, so check it before sharing. |
native/, notifications/, .tmp/, kotlin-profile/ | Internal working folders. |
The first six rows are in Gradle's documentation. The last row is what appeared on the Mac used for this guide, where the caches folder was missing entirely; Gradle creates it again on the next build. A Mac that builds regularly will show caches/ too. Gradle's directory-layout page lists modules-2 (downloaded dependencies) and build-cache-1 (the local build cache) inside it, alongside version-numbered folders for each Gradle release you have run.
Every project that ships a gradlew script pulls the Gradle version it asks for into wrapper/dists. On the Mac used for this guide that folder held two versions, gradle-7.5-all and gradle-8.12-bin. The -bin and -all suffixes mean the binary-only or the full distribution with sources and docs; the -all ones are larger. Old versions pile up as projects age.
du -sh ~/.gradle
du -sh ~/.gradle/* | sort -h
du -sh ~/.gradle/.[!.]* 2>/dev/null | sort -h
All three only read sizes. The second and third lines cover visible and hidden children respectively.
Gradle removes unused cache entries in the background about once every 24 hours. The documented default retention is 30 days for released wrapper distributions and downloaded resources, 7 days for snapshot distributions, created resources and the build cache, and 14 days for daemon logs. You can change this, or turn it off, with an init script in init.d/. So a cache that is large but recently used is normal. One that is large and untouched for months suggests cleanup is disabled or Gradle has not run.
Everything under caches/ is re-created on demand, so the safe order is:
./gradlew --stop in a project, then quit Android Studio and IntelliJ IDEA. It stops only daemons started by that project's Gradle version, so repeat it in projects that use other versions.~/.gradle/caches to the Trash in Finder.For older wrapper versions, delete only the version folders you no longer use from ~/.gradle/wrapper/dists. Gradle re-downloads one if a project asks for it. Do not delete gradle.properties or init.d/ unless you know what is in them: they hold your own settings, not cache.
Cleaning does not touch your projects. Per project, Gradle keeps a .gradle/ folder next to the build files and a build/ folder for output, and these are separate from ~/.gradle. They are safe to delete too, and they are rebuilt next time.
Gradle reads the GRADLE_USER_HOME environment variable; if it is set, that folder replaces ~/.gradle. Note it is not the same as GRADLE_HOME, which points at an installed Gradle. For a build run from Terminal, add this to ~/.zshrc:
export GRADLE_USER_HOME=/Volumes/FastDrive/gradle-home
Apps launched from the Dock, Android Studio included, do not read ~/.zshrc. Android Studio has its own Gradle user home field in its Gradle settings (Settings > Build, Execution, Deployment > Build Tools > Gradle; the field name was checked in Android Studio 2024.1). Move the existing folder contents across first, or Gradle starts with an empty cache.
There is no need to copy the cache; it is downloaded again. Keep your gradle.properties if you set anything in it, and your init.d scripts. Projects bring their own wrapper settings, so the right Gradle version comes back on its own. Time Machine includes hidden folders by default, so you may want to exclude ~/.gradle/caches to keep backups small.
Spotlight and Finder searches leave out hidden dot-folders, so the dependencies, JDKs and wrapper downloads inside ~/.gradle never show up, even when you type the exact jar name.
Everywhere indexes names in hidden folders, so you can type gradle-8 to see which wrapper versions are installed, or a library name like okhttp to find its jar inside the cache. It searches file names only, not the code inside the jars. Press ⌘↵ to reveal a result in Finder.
Under ~/.gradle/caches, inside the Gradle user home ~/.gradle. If GRADLE_USER_HOME is set, that folder is used instead.
Mostly. Caches, wrapper downloads and JDKs are re-downloaded when needed, but gradle.properties and init.d hold your own settings, so keep those. Stop Gradle daemons and quit your IDE first.
Into ~/.gradle/wrapper/dists, one folder per version, such as gradle-8.12-bin.
Set the GRADLE_USER_HOME environment variable to the new folder. Terminal builds read it from your shell profile; apps launched from the Dock need it set another way.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Version 2.20.3 · macOS 13+ · 4.7 MB · notarised