misonoteApp Center

Gradle caches (~/.gradle/caches) on Mac: safe to delete?

Safe to deleteRegenerated automatically; Thermo deletes it outright.

Quit first: java

Where it is

  • ~/.gradle/caches
  • ~/.gradle/daemon
  • ~/.gradle/wrapper/dists

What it is

~/.gradle is Gradle's user home. The caches folder holds downloaded dependencies, transformed artifacts and the local build cache; daemon holds logs and registry data for background Gradle daemons; and wrapper/dists stores the full Gradle distributions that each project's wrapper downloads.

Why it gets so big

Each Gradle version used by any project's wrapper is downloaded in full, and Android projects in particular pull in large dependency and transform caches. Old versions linger after projects upgrade.

Is it safe to delete?

Yes. Gradle downloads dependencies and wrapper distributions again on the next build, which can take a while for large Android projects. Stop running Gradle daemons first, including ones started by Android Studio or IntelliJ, since they run as Java processes that keep these files open. Your gradle.properties and init scripts sit outside these folders and are kept.

Tip

Gradle's stop option shuts down all background daemons, which is the cleanest way to make sure nothing is holding the caches open.

See how much space it uses

du -sh "$HOME/.gradle/caches" "$HOME/.gradle/daemon" "$HOME/.gradle/wrapper/dists" 2>/dev/null

Delete it by hand

Run in Terminal. Deleting cannot be undone, so check the paths first.

rm -rf "$HOME/.gradle/caches"/*
rm -rf "$HOME/.gradle/daemon"/*
rm -rf "$HOME/.gradle/wrapper/dists"/*