DEV Community

ran Guo
ran Guo

Posted on

A macOS disk cleaner that shows the cost before it deletes

Most cleanup tools ask for the same thing: trust. You press Clean, a progress bar moves, a number goes up. What the number never tells you is whether the 12 GB it just removed was a cache the app rebuilds in ten minutes, or a project you spent the week on.

DiskWise is an open-source macOS cleaner built around one rule: before anything moves, show the cost of every item.

Two labels instead of a score

The scanner produces a list of reclaimable directories. Every entry gets one of two labels:

  • Harmless β€” caches, logs, temp files. They come back when needed.
  • Downloads again β€” recoverable, but only by downloading or rebuilding.

No score out of 100. A score invites arguments; a label forces a decision. Anything the scanner cannot describe with confidence stays out of the cleanup list.

Three steps, one delete path

  1. Plan. The scan groups directories by cause: app caches, Xcode build artifacts, simulator data, node_modules, Homebrew downloads, Docker layers, AI coding tool sessions. You pick.
  2. Confirm. The app restates the selection with paths and sizes. It feels redundant until you are staring at twelve similarly named folders.
  3. Receipt. When it finishes, you get a summary of what moved, what is in the Trash, and how to undo.

The delete path is deliberately boring: FileManager.default.trashItem, plus two guards β€” a protected-path check and an allowed-root check. No rm, no privileged helper. Undo restores from the Trash, so there is no private journal that can disagree with the filesystem.

The scan is conservative, because the allowlist is the whole product

Every entry carries a written explanation: what this folder is, and what happens after it is removed. Developer locations are treated differently from caches. Xcode DerivedData, simulator devices, package manager caches, and node_modules are presented read-only: the app points at them, you decide what to do.

That is also why there is no "clean everything" button. Aggressive cleanup is easy to demo and hard to forgive.

The same guardrails for agents

diskwise mcp starts a local stdio MCP server with six tools: scan_disk, explain_path, plan_cleanup, execute_cleanup, undo_cleanup, cleanup_history. The protocol surface is intentionally narrow. An agent gets a plan it must execute explicitly, deletion still goes to the Trash, and the last operation can be undone. No network access, no telemetry.

What it is not

It is not a speed-up tool, an antivirus, or an app uninstaller. It shows where the space went, explains what each removal costs, and keeps the whole thing reversible. That is the entire product.

Repo: https://github.com/DreamOfXM/diskwise β€” free and open source, available from GitHub Releases and the Mac App Store.

Top comments (0)