# Is it safe to delete Gradle’s caches in ~/.gradle?

Is it safe to delete? · Package caches · Updated 21 November 2026. By Mohit Nippanikar, who makes SiftMac.

## The short answer

- **Yes**, with Gradle stopped. `caches`, `wrapper/dists`, `jdks` and the daemon logs are downloads and build data Gradle fetches or makes again. Keep `gradle.properties` and `init.d`: those are your settings.
- **What it costs you:** the next build downloads dependencies, and perhaps a Gradle distribution and a JDK, before it starts, so it runs slower that once.
- **Does it come back?** Yes. Gradle also prunes these folders itself, so clearing by hand is mainly for getting space back now.
- SiftMac’s verdict: Rebuilds

## 1. What’s in ~/.gradle

`~/.gradle` is the Gradle User Home, shared by every Gradle and Android project you build, from Terminal or from Android Studio and IntelliJ IDEA. Gradle’s docs list what lives there:

- `caches`: downloaded dependencies (in `caches/modules-2`), transformed and compiled files, and caches tied to each Gradle version.
- `wrapper/dists`: complete Gradle distributions downloaded by `./gradlew`, one for each version your projects asked for.
- `jdks`: JDKs Gradle downloaded for toolchains.
- `daemon`: the registry and logs of Gradle daemons.
- `gradle.properties` and `init.d`: your global properties and init scripts.

## 2. Where it is

```
~/.gradle
```

`GRADLE_USER_HOME` moves it. Each project also has its own `.gradle` folder and `build` output, covered further down.

## 3. How big it gets, and what Gradle prunes itself

```
du -sh ~/.gradle/* 2>/dev/null | sort -h
```

Gradle cleans its user home on its own, by default at most once every 24 hours, in the background when a daemon stops:

- Caches for a Gradle version nothing uses any more are deleted after 30 days of inactivity, or 7 days for snapshot versions.
- Files in the shared caches are deleted after 7 days unused if Gradle can recreate them locally, or after 30 days if they’d have to be downloaded again.
- Wrapper distributions no longer in use are deleted, and so are daemon logs older than 14 days.

So a large `~/.gradle` usually means many projects, Gradle versions or JDKs in recent use, or a cleanup that someone switched off in an init script.

## 4. How to clear it safely

1. Quit Android Studio or IntelliJ IDEA, and let running builds finish.
2. Stop the daemons with `./gradlew --stop` in a project, or `gradle --stop`. Each stops only daemons of its own Gradle version; others shut themselves down after 3 idle hours, and `gradle --status` lists those of the current version.
3. Clear the caches, then look at which distributions you have.

```
./gradlew --stop
rm -rf ~/.gradle/caches/*
ls ~/.gradle/wrapper/dists
```

Delete a version folder in `wrapper/dists` only if no project still uses that Gradle version; otherwise that project’s next `./gradlew` downloads it again. Leave `gradle.properties`, which can hold signing settings and repository credentials, and `init.d` alone.

### In each project

A project’s `build` folder is its output: the `clean` task deletes the build directory, and the next build makes it again. The project’s `.gradle` folder is Gradle’s per-project cache, with build state for incremental builds and the configuration cache; it can go too, with Gradle stopped.

```
./gradlew clean
```

## 5. What the next build does

- Downloads every dependency again from your repositories, so it needs the network and takes longer. Builds with `--offline` fail until then, because they can’t fetch what’s missing.
- Downloads the Gradle distribution if you removed its folder from `wrapper/dists`, and a toolchain JDK if you cleared `jdks`.
- Rebuilds the transformed and compiled files it had cached.
- Your source, build scripts and settings stay as they were.

## Questions

### Is it safe to delete the whole ~/.gradle folder?

Mostly, but it also deletes `gradle.properties` and `init.d`, which are your settings rather than cache. Clear `caches`, `wrapper/dists` and `jdks` instead.

### Do I need to stop the Gradle daemon first?

Yes. Gradle shares its caches between running processes using lock files, so stop the daemons before removing files from under them. `--stop` takes a moment.

### Can I make Gradle clean up sooner?

Yes, with an init script in `~/.gradle/init.d` that shortens the retention periods. Gradle only reads cache cleanup settings from init scripts.

### Does clearing ~/.gradle remove my Android emulators?

No. Emulators and the SDK live in `~/.android` and `~/Library/Android/sdk`; see [Android emulators](https://siftmac.com/safe-to-delete/android-emulators) and the [Android SDK](https://siftmac.com/safe-to-delete/android-sdk).

## How SiftMac handles it

Its Developer files category lists each project’s `build` and `.gradle` folders, next to a `build.gradle` or `settings.gradle` file, in projects you haven’t changed for 1, 3 or 6 months; none is ticked until you tick it. SiftMac doesn’t clear `~/.gradle` itself: the space map shows its size and notes that the dependencies download again on the next build.

Download: https://siftmac.com/SiftMac.dmg (scanning is free, and so is the first 2 GB of cleaning).

## Sources

- [Gradle User Manual: Gradle directories (user home, cache cleanup)](https://docs.gradle.org/current/userguide/directory_layout.html)
- [Gradle User Manual: the Gradle Daemon](https://docs.gradle.org/current/userguide/gradle_daemon.html)
- [Gradle User Manual: dependency caching](https://docs.gradle.org/current/userguide/dependency_caching.html)
- [Gradle User Manual: the Base Plugin’s clean task](https://docs.gradle.org/current/userguide/base_plugin.html)

## Related

- [Is it safe to delete ~/.m2/repository?](https://siftmac.com/safe-to-delete/maven-repository)
- [Is it safe to delete the Android SDK folder?](https://siftmac.com/safe-to-delete/android-sdk)
- [Is it safe to delete ~/Library/Caches/JetBrains?](https://siftmac.com/safe-to-delete/jetbrains-caches)
- [Xcode DerivedData, node_modules and Docker: what’s safe to delete on a developer’s Mac](https://siftmac.com/guides/developer-files-on-mac)
- [What fills a developer’s Mac, and what’s safe to delete](https://siftmac.com/for/developers)

Canonical: https://siftmac.com/safe-to-delete/gradle-caches
