---
title: "How to clean developer files on macOS · MacMelon"
description: "A pillar guide to npm caches, Gradle, Cargo, Xcode DerivedData, and node_modules, and how Disk Housekeeper previews each before the Trash."
url: "https://macmelon.com/guides/how-to-clean-developer-files-on-macos"
---

# How to clean developer files on macOS

Developer machines fill up with caches that can be rebuilt. The risk is removing the one you still need today. Preview, Trash, then reinstall.

A Mac that builds software accumulates copies: one node\_modules per checkout, a shared npm cache, a Gradle cache, a Cargo registry, and Xcode DerivedData. [Smart Clean](https://macmelon.com/glossary/smart-clean) in [Disk Housekeeper](https://macmelon.com/apps/disk-housekeeper) is the feature aimed at that set.

The rule underneath every link on this page is the same. Read the path. Confirm the preview. Leave the removal in the Trash until a project you care about still builds or installs.

## Separate the project folder from the cache

node\_modules belongs to one project and is recreated from the lockfile. The npm cache is shared and stores tarballs. Deleting one does not delete the other. Gradle and Cargo have the same shape: a user-level cache, not your repository.

-   [node\_modules](https://macmelon.com/glossary/node-modules)
-   [npm cache](https://macmelon.com/glossary/npm-cache)
-   [Gradle cache](https://macmelon.com/glossary/gradle-cache)
-   [Cargo cache](https://macmelon.com/glossary/cargo-cache)
-   [Delete node\_modules safely](https://macmelon.com/use-cases/delete-node-modules-safely)
-   [Clean npm, Gradle, and Cargo caches](https://macmelon.com/use-cases/clean-developer-caches)

## Xcode is a special case of the same idea

DerivedData is the build cache. The Xcode app is not. Removing DerivedData makes the next build slower and does not remove your source. Do not confirm a preview whose path is the application.

-   [DerivedData](https://macmelon.com/glossary/deriveddata)
-   [Xcode](https://macmelon.com/glossary/xcode)
-   [Clear Xcode DerivedData](https://macmelon.com/use-cases/clear-xcode-deriveddata)

## Offline work and the Trash

If the next resolve needs the network and you do not have it, do not clear the cache yet. If you do clear it, the Trash is the default, so you can put a folder back. Empty the Trash after you have proved the reinstall, not before.

-   [Trash](https://macmelon.com/glossary/trash)
-   [Preview before cleaning](https://macmelon.com/glossary/preview-before-cleaning)
-   [Developer cache](https://macmelon.com/glossary/developer-cache)

## Questions

Does Smart Clean know every package manager?

It is described as covering developer caches such as npm, Gradle, and Cargo, plus Xcode DerivedData and node\_modules. If a tool is not in that list, do not assume it is included. Read the preview.

Will this break a project permanently?

Not if the lockfile or the source is intact and you can reinstall or rebuild. The Trash is there so you can undo before you empty it. A project without a lockfile is one to leave out of the clean.

## Related use cases

[### Clean npm, Gradle, and Cargo caches](https://macmelon.com/use-cases/clean-developer-caches)[### Delete node\_modules safely](https://macmelon.com/use-cases/delete-node-modules-safely)[### Clear Xcode DerivedData](https://macmelon.com/use-cases/clear-xcode-deriveddata)

## Related terms

[### Smart Clean](https://macmelon.com/glossary/smart-clean)[### Developer cache](https://macmelon.com/glossary/developer-cache)[### node\_modules](https://macmelon.com/glossary/node-modules)[### DerivedData](https://macmelon.com/glossary/deriveddata)[### npm cache](https://macmelon.com/glossary/npm-cache)

## Related notes

[### Deleting node\_modules without regretting it](https://macmelon.com/blog/deleting-node-modules-without-regrets)
