Unduped

Why deleting a duplicate on your Mac often frees nothing

I made a 1 GB file on my Mac, duplicated it, deleted the duplicate, and got back zero bytes. That’s how Mac disks work, and it’s why a duplicate finder that just adds up file sizes will promise you space you never see.

I make a duplicate finder, Unduped, so I spend a lot of time on this gap between the number on screen and the space that actually comes back.

The copy that isn’t really a copy

A Mac’s startup disk uses APFS. When you duplicate a file in the Finder, or copy and paste it on the same disk, APFS doesn’t write the data a second time. It makes a clone, a new file that points at the same blocks as the original. The clone only starts taking space when one of the two files changes.

Here’s the test. One 1 GB file, then a clone of it, then an ordinary copy, with the free space read after each step:

FileSizeTookDeleting frees
OriginalHoliday.mov1.07 GB1.07 GB—
CloneHoliday copy.mov1.07 GB0 MB0 MB
Real copyHoliday (real copy).mov1.07 GB1.07 GB1.07 GB

ls shows all three at 1,073,741,824 bytes. du says the folder holds 3 GB. The disk says 2. Delete the clone and the free space doesn’t move by a single megabyte, while a tool that sums file sizes would have counted it as 1.07 GB to gain.

Anyone who duplicates files in the Finder ends up with these. “Report copy.pdf”, the folder you duplicated before a big edit. They look exactly like duplicates, and many of them free nothing.

A few other ways the number lies

Clones aren’t the only case. A hard link is one file with two names, so deleting one name frees nothing while the other is still there. With Optimize Mac Storage turned on, a lot of files in iCloud Drive are just placeholders that take almost no space on your Mac, and moving one to the Trash removes it from your other devices too. And everything you delete sits in the Trash until you empty it. If you back up with Time Machine, a local snapshot can hold on to those files for about a day after that.

How Unduped counts

For each file in a duplicate group, Unduped asks APFS which clone family the file belongs to and how many of its bytes are its own. Both come from getattrlist. A clone family counts once, hard links count once, and files that exist only in iCloud are listed but never counted. What’s left is the number at the top of the results, Really frees. Clones get a label, so you can see why a 1 GB copy adds nothing to it.

Files are matched by their full contents, not names, so “Report (1).pdf” matches “Report.pdf” and two different files called “Notes.txt” don’t.

My own app told me I freed 0 KB

After you empty the Trash, Unduped compares the free space before and after and tells you what came back. The first time I tested that on my own Mac, I emptied a Trash with about 735 MB from older cleanups, and the app said it had freed 0 KB.

There were no Time Machine snapshots, and when I deleted 700 MB from Terminal the free space came back within a second. It took a test that printed every free-space value to see what was going on. Inside the App Sandbox, macOS reports free space in steps of exactly 409.6 MB, whether you ask statfs, the URL resource keys or FileManager. Outside the sandbox the same calls are exact. So 735 MB can come out as 0, 410 MB or 819 MB, depending on where the steps fall. Mine came out as 0.

Now the app shows a measured number only for cleanups of about 8 GB or more, where one step is at most 5 %. For smaller ones it just says how much left the Trash.

How I measured. macOS 27, APFS. Free space read with statvfs after each step, from a process outside the sandbox. The clone was made with cp -c, the same kind of clone the Finder makes. The sandbox numbers come from Unduped’s own tests, which delete real folders from the Trash and print what each API reports.

If you want to try it

Unduped always keeps at least one copy of every file, moves the rest to the Trash, and can undo your last 5 cleanups. It also finds photos on your disks that are already in your Photos library, and it only ever reads the library. Since version 1.1 there’s a Developer section for the builds and caches that Xcode, Gradle and npm make again. On my Mac it marked 62 GB the first time. In one cleanup I moved 40.49 GB to the Trash, and emptying it gave back all of it.

Scanning is free and shows every result. You can move 500 MB of duplicates and 5 GB of developer files to the Trash for free. After that it’s a one-time $14.99 in the US, with no subscription. Nothing you scan leaves your Mac.

View on the Mac App Store

Requires macOS 14 Sonoma or later. Questions or corrections: andrroider.app@gmail.com.