---
title: "Clean npm, Gradle, and Cargo caches · MacMelon"
description: "Smart Clean can remove npm, Gradle, and Cargo caches after a preview. The next resolve may download them again."
url: "https://macmelon.com/use-cases/clean-developer-caches"
---

# Clean npm, Gradle, and Cargo caches

These caches exist so the next build does not re-download the world. Remove them only when you can afford the next download.

A [developer cache](https://macmelon.com/glossary/developer-cache) is a copy of something a tool can fetch again: the [npm cache](https://macmelon.com/glossary/npm-cache), the [Gradle cache](https://macmelon.com/glossary/gradle-cache), and Cargo's downloaded crates. [Disk Housekeeper](https://macmelon.com/apps/disk-housekeeper) groups them under Smart Clean, together with Xcode DerivedData and node\_modules.

They are safe to remove in the narrow sense that the tool can recreate them. They are expensive to remove if you are offline or in a hurry.

## Steps

1.  ### Decide whether the next download is acceptable

    Clearing a cache does not delete your source. It does mean the next npm install, Gradle resolve, or cargo fetch may hit the network and take longer.

2.  ### Open the preview and separate the three

    npm, Gradle, and Cargo live in different directories. The preview should show you which tool the folder belongs to. Remove one family if you only need one family's space.

3.  ### Send them to the Trash

    Default behavior is the Trash, after the preview. You can restore a cache folder if a build immediately complains and you would rather not re-download yet.

4.  ### Read the savings history later

    The history is the record of what this clean returned. Compare it with the menu bar readout. If the readout barely changed, the Trash may still be holding the files.

## Before you start

-   Do this on a connection you are willing to use. A full Cargo registry or Gradle cache can be a large download the next time.
-   node\_modules is not the npm cache. DerivedData is not the Gradle cache. Uncheck what you did not intend.

## Questions

Where do these caches usually live?

Often under the user Library or the home directory: an npm cache path, ~/.gradle/caches, and ~/.cargo. A custom configuration can move them. Use the path in the preview.

Does Smart Clean include all three?

Smart Clean covers developer caches such as npm, Gradle, and Cargo, plus Xcode DerivedData and node\_modules. The preview is the list for your machine.

## Apps

[Make room for what matters. Clear clutter with confidence. ### Disk Housekeeper](https://macmelon.com/apps/disk-housekeeper)

## Related guides

[### How to clean developer files on macOS](https://macmelon.com/guides/how-to-clean-developer-files-on-macos)

## Related use cases

[### Delete node\_modules safely](https://macmelon.com/use-cases/delete-node-modules-safely)[### Clear Xcode DerivedData](https://macmelon.com/use-cases/clear-xcode-deriveddata)[### Free up space on a MacBook](https://macmelon.com/use-cases/free-up-space-on-a-macbook)

## Related terms

[Files a developer tool keeps so the next build or install can skip a download or a compile. ### Developer cache](https://macmelon.com/glossary/developer-cache)[npm's on-disk store of package tarballs, reused by later installs. ### npm cache](https://macmelon.com/glossary/npm-cache)[Gradle's user-level store of dependencies and build outputs. ### Gradle cache](https://macmelon.com/glossary/gradle-cache)[Cargo's local copy of downloaded crates and related git checkouts. ### Cargo cache](https://macmelon.com/glossary/cargo-cache)[Disk Housekeeper's cleaner for developer caches and node\_modules, behind a preview. ### Smart Clean](https://macmelon.com/glossary/smart-clean)

## Related notes

[node\_modules is recreatable from a lockfile, and it is also easy to remove the wrong copy. A preview and the Trash are the difference. ### Deleting node\_modules without regretting it](https://macmelon.com/blog/deleting-node-modules-without-regrets)
