# Gradle Cache on Mac: Is ~/.gradle/caches Safe to Delete?

> ~/.gradle/caches holds downloaded dependencies, transforms and the build cache for Gradle and Android Studio. It's safe to delete with Gradle stopped.

- Updated: 2026-10-10
- URL: https://fresh.ist/caches/gradle/

**TL;DR:** Yes, with Gradle stopped first. ~/.gradle/caches stores dependencies downloaded from Maven repositories, transformed artifacts and the local build cache, shared by every Gradle and Android Studio project. Deleting it loses no code or settings. The next build re-downloads dependencies and rebuilds everything, which can take a long time on Android projects. Gradle also cleans unused entries automatically.

## Facts from the Freshist app

- Category in Clean: Gradle Cache — "Build cache — next Gradle builds re-download dependencies."
- Location: `~/.gradle/caches`
- Risk level: Medium risk — Safe to remove, but the tool that owns it re-downloads or rebuilds it on next use, which costs time and bandwidth. Listed, never pre-selected.
- Selected by default: no
- What Freshist does: Moves the selected items to the Trash, so you can undo. Nothing is deleted outright.

## What lives in ~/.gradle/caches

Gradle keeps its shared state in the Gradle user home, `~/.gradle` unless `GRADLE_USER_HOME` says otherwise. The `caches` folder inside it is used by every build on your Mac, from the command line or from Android Studio and IntelliJ IDEA.

| Folder | What it holds |
|---|---|
| `modules-2/` | Dependencies downloaded from Maven Central, Google's Maven repository and others, plus their metadata |
| `transforms-*/` | Artifacts Gradle has transformed, such as Android libraries processed for compilation |
| `build-cache-1/` | The local build cache: task outputs reused across builds and branches |
| `jars-*/`, `<version>/` | Per-Gradle-version caches for compiled build scripts and plugins |

The full layout is in the [Gradle directory layout docs](https://docs.gradle.org/current/userguide/directory_layout.html). Two neighbours are often large too: `~/.gradle/wrapper/dists`, which holds whole Gradle distributions downloaded by the wrapper, and `~/.gradle/daemon`, which holds daemon logs.

## Why Android projects make it huge

Every Gradle version you've used keeps its own versioned folders, and Android projects bring hundreds of dependencies plus heavy transforms. Switching branches, upgrading the Android Gradle Plugin, or opening sample projects all add more.

Gradle does clean up on its own. Per the docs, unused downloaded resources are removed after 30 days by default, and resources Gradle created itself (like transforms) after 7 days. Versioned caches for Gradle versions you no longer run are cleaned up too. The docs say these caches normally need no manual management, but cleanup only runs when Gradle itself runs, and it doesn't cover projects you've stopped opening for good.

## What happens if you delete it

- The next build downloads every dependency again. For a large Android app that's a lot of data and can take many minutes.
- Transforms and the local build cache are recomputed, so the first build is a full, uncached build.
- `--offline` builds fail until the dependencies are back.
- Project files, `build.gradle(.kts)`, version catalogs, and your `gradle.properties` aren't touched.
- Project-level `build/` folders and `.gradle/` folders inside projects are separate; delete those per project if you want.

## Size it up

```sh
du -sh ~/.gradle/caches ~/.gradle/wrapper/dists ~/.gradle/daemon 2>/dev/null
du -sh ~/.gradle/caches/* | sort -h | tail
ls ~/.gradle/wrapper/dists        # Gradle versions downloaded by the wrapper
```

## Clear it safely

Gradle has no single "clear cache" command, so clearing means deleting the folder with nothing running:

1. Stop the daemons: run `./gradlew --stop` in a project (or `gradle --stop`), and quit Android Studio or IntelliJ IDEA.
2. Delete `~/.gradle/caches`. Optionally delete old versions under `~/.gradle/wrapper/dists` and the `~/.gradle/daemon` folder.
3. Open the project and build or sync once to repopulate it.

Stopping the daemons matters. A running daemon holds locks on cache files and may write to them while they're being removed. If you only want Gradle's automatic cleanup to be more aggressive, Gradle 8 lets you set retention periods in an init script; see the cache cleanup section of the docs.

## When not to clear it

Keep it if you're about to work offline, on a metered connection, or right before a release where a long cold build would hurt. Clear it after leaving Android or JVM work, after upgrading Gradle versions several times, or when a corrupt dependency causes errors that `--refresh-dependencies` doesn't fix. Maven keeps a separate repository in `~/.m2`, covered in the [Maven cache](/caches/maven/) guide, and IDE caches are in [JetBrains caches](/caches/jetbrains/).

## Sources

- [Gradle docs: Gradle directory layout and cache cleanup](https://docs.gradle.org/current/userguide/directory_layout.html)
- [Gradle docs: dependency caching](https://docs.gradle.org/current/userguide/dependency_caching.html)
- [Gradle docs: the Gradle daemon](https://docs.gradle.org/current/userguide/gradle_daemon.html)

## Frequently asked questions

### Can I delete the whole ~/.gradle folder?

Better not. gradle.properties there can hold signing settings, proxy config and repository credentials, and init.d holds init scripts. Clear caches/, and optionally wrapper/dists and daemon/, but keep the files you or your team configured.

### Does --refresh-dependencies do the same thing?

Not quite. ./gradlew build --refresh-dependencies tells Gradle to recheck remote repositories and update cached entries for that build. It doesn't free space; deleting the cache does.

### Why does Android Studio sync take so long after clearing?

Sync resolves and downloads every dependency the project declares, including the Android Gradle Plugin and its own dependencies, then re-runs artifact transforms. The first sync after a cleared cache is a full download.

---

Canonical page: https://fresh.ist/caches/gradle/
Official site: https://fresh.ist/ (fresh.ist only)
Generated: 2026-10-10
