Can I Delete the .gradle Folder on My Mac? Yes, Here's How

Yes, it's safe to deleteDiskmack safety tier: Safe to clean
~/.gradle**/.gradle

Yes, you can delete the .gradle folder. Both the big one in your home directory (~/.gradle) and the small .gradle folders inside individual projects are caches, and Gradle re-downloads or rebuilds everything it needs on your next build. The only real cost is a slower first build while dependencies come back down. One small caveat: if you keep custom settings in ~/.gradle/gradle.properties, copy that file somewhere safe first.

What it is

The ~/.gradle folder in your home directory belongs to Gradle, the build tool that every Android Studio project uses and that most modern JVM projects run, whether from IntelliJ IDEA or the command line. It holds Gradle's dependency cache (every JAR and AAR library any of your projects has ever downloaded), its build cache, daemon logs, and full downloaded Gradle distributions under wrapper/dists. Each project can pin its own Gradle version, and each version unpacks to a few hundred megabytes, so a machine that has touched a handful of projects often carries several distributions it no longer uses. On developers' Macs the whole folder commonly runs several gigabytes, and heavy Android setups can pass 20 GB.

Separately, each Gradle project keeps a hidden .gradle folder next to its build.gradle file. That one holds per-project build state and caches: task history, file checksums, configuration caches. Individually these are usually modest, tens to hundreds of megabytes, but there is one in every project you have ever built, including old experiments you forgot about, and together they add up.

Is it safe to delete?

Everything in both locations is rebuildable, which is why they sit in the safe tier. Delete ~/.gradle and the next build re-downloads the pinned Gradle distribution and refills the dependency cache, so a build that normally takes seconds may take minutes once. None of your source code lives there. The one thing worth preserving is configuration: ~/.gradle/gradle.properties (memory flags, proxy settings, credentials for private repositories) and any init scripts in ~/.gradle/init.d do not regenerate. If you have customized those, keep copies, or delete only the caches and wrapper subfolders and leave the rest.

The per-project .gradle folders are just as safe. Gradle rebuilds them from scratch on the next build of that project, at the cost of losing incremental build state, so the first build afterward does more work. Diskmack identifies both the user-level cache and the per-project .gradle folders automatically and cleans them the safe way.

How to check its size

In Finder: In Finder, choose Go > Go to Folder (Shift-Command-G), type ~/.gradle and press Return. The folder is hidden, so Go to Folder is the quickest way in. Once the window opens, press Command-I with nothing selected to get info on the folder you are viewing; give it a moment, since Finder has to count thousands of small cache files. Or select the caches and wrapper subfolders and press Command-I to size those separately.

In Terminal:

du -sh ~/.gradle

The shell expands ~ to your home folder. For a breakdown of where the space actually is, run du -sh ~/.gradle/caches ~/.gradle/wrapper instead.

How to clean it

  1. Quit Android Studio, IntelliJ IDEA, and anything else that might be running a build. If you recently built a project, stop lingering Gradle daemons: open Terminal, type cd followed by a space, drag the project's folder into the window, press Return, then run ./gradlew --stop
  2. If you use a custom ~/.gradle/gradle.properties or scripts in ~/.gradle/init.d, copy them to your Desktop first.
  3. In Finder, choose Go > Go to Folder, enter ~/.gradle and press Return.
  4. Drag the caches and wrapper folders to the Trash. If you have no custom configuration to keep, press Command-Up Arrow to step up to your home folder, press Shift-Command-Period to show hidden files, and drag the whole .gradle folder to the Trash instead.
  5. For project-level caches, open a project's folder in Finder, press Shift-Command-Period to show hidden files, and drag that project's .gradle folder to the Trash.
  6. Empty the Trash to actually reclaim the space.

Gradle has no official one-shot command that clears the user-level cache. Do not delete the folder while a build is running; stop the daemons first.

Will it come back?

Yes, by design. The next time you build any Gradle project, the wrapper re-downloads its pinned Gradle distribution and the dependency cache refills with every library that build needs, so the folder starts regrowing within a single build. It will not snap back to full size immediately, because only the dependencies you actively build against return; the leftovers from abandoned projects stay gone. Recent Gradle versions also prune cache entries that sit unused for about a month, which keeps growth somewhat in check. If you build Android apps daily, expect several gigabytes back within a couple of weeks.

Common questions

Will deleting ~/.gradle break Android Studio?

No. Android Studio keeps its own settings elsewhere, under ~/Library. Deleting ~/.gradle only removes Gradle's caches, so the next project sync re-downloads what it needs. Expect that first sync to take noticeably longer than usual, then everything is back to normal.

What is the difference between ~/.gradle and the .gradle folder inside my project?

~/.gradle is the shared, user-level cache: downloaded libraries and Gradle distributions used by all your projects. The .gradle folder inside a project holds only that project's build state. Both are safe to delete, and both come back on the next build.

Can I delete just part of ~/.gradle instead of the whole thing?

Yes, and it is often the smarter move. The space lives almost entirely in ~/.gradle/caches and ~/.gradle/wrapper. Deleting only ~/.gradle/wrapper/dists removes every downloaded Gradle distribution: the versions your projects still pin re-download on the next build, the stale ones stay gone. Either way your gradle.properties and init scripts are untouched.

Will I need an internet connection after deleting it?

Yes, for the first build. Gradle has to re-download the distribution and every dependency from the network, so do not clear this cache right before working somewhere without a connection.

Related folders