RawData

Every gigabyte accounted for

A disk space analyzer has one job before any other: its numbers have to be right.

If it says a folder takes 40 GB and Finder says 31, you'll never trust it to tell you what's safe to throw away. And an app that helps you delete things has to be trusted, or it's worse than no app at all.

In the last post we told how Mac Deficit sat untouched for eleven months, and how we came back to it at 2:44 one morning and read every line before writing a new one. The review's first finding was 17 GB of Messages attachments the scanner had never counted. This is the rest of that night: seven sessions spent making every gigabyte add up, and then making it fast.

Length is not space

The December scanner added up each file's length: how many bytes are in it. That sounds like the right answer, but it isn't what a file costs your drive.

A drive hands out space in blocks. A one-byte file still takes a whole block. Some files are sparse: they claim gigabytes but only store the parts that aren't empty. And some files live in two places at once through hard links, one file with two names, that cost the drive once but would be counted twice by anyone adding up lengths.

So in Session 12 Mac Deficit started measuring size on disk, the space a file really takes, the same figure Finder and macOS report. Every hard-linked file is now counted once. And a scan stays on the drive you chose: another drive or disk image mounted inside a folder you're scanning isn't counted as part of it anymore.

The result: on our test Mac, a home folder scan matched the system's own count to the hundredth of a gigabyte.

One owner for "where not to look"

The Messages bug came from a list: folders the scanner should skip. A second list said which folders macOS protects. Others decided what counted as system data. They lived in different places, and they didn't quite agree.

We'd seen this before. On Pbuild we spent a whole session asking who makes it? of every line of code, because everything kept in two places eventually drifts. Mac Deficit got the same rule: one owner per system. There's now one place that knows which paths are skipped, which are macOS's own and which are protected, and the scanner, the drive list, the Full Disk Access check and the list view all ask it.

It adds up

With one owner in place, a whole-drive scan could finally show everything, including the folder most analyzers leave out: /private, where macOS keeps its caches, temporary files and the sleep image. Mac Deficit now shows it, labelled System data, so the big grey lump has a name and you can look inside it.

On our test Mac, the whole drive now matched the system's own count exactly: 297.81 GB.

Then the gaps. Some folders macOS won't let any app read without permission. The old scanner skipped those in silence. Now each is kept in the results and marked as unreadable, so you can see where the gaps are and decide whether to grant Full Disk Access. On our test Mac, the scanner's list of folders it couldn't read was exactly the system's own list: 221 of 221.

And one small honesty fix along the way: files and folders are counted separately now, so "files" means files everywhere it appears.

Then make it fast

Only once the numbers were right did we let ourselves touch speed, with one rule: every speedup has to find exactly the same files and sizes. Not roughly. Exactly. Each change was checked against the scan before it.

Same files. Same sizes. Five times faster than the night began, and half the memory.

What it adds up to

Here's where Mac Deficit stands after one week in December and one night in November:

Next

The scanner is ready. Next it moves into the new native Mac app, written in Swift, and the apple gets its true shape: every block held inside a real apple, and your drives shown as apples of their own.

Then the part Mac Deficit is for. Reveal in Finder. Move to the Trash, with the space it frees shown before you say yes. Clearing several things at once. And after that, drives that appear as you plug them in, settings that are remembered, and a signed, notarized app you can download.

No release date yet. The roadmap and screenshots are on GitHub, and the project page shows each session as it lands.

We came back to find out where the space went. Turns out the first step was counting all of it.

~ Jer & Claude