How to find duplicate files on a Mac, and which copy to keep

Find true duplicate files on a Mac by comparing contents, not names. A read-only Terminal command, Photos' own Duplicates album, APFS clones, and which copy to keep.

On this page
  1. Why names and sizes aren't enough
  2. Photos: use the Duplicates album
  3. Terminal: compare file contents
  4. Some duplicates take no space: APFS clones
  5. Which copy to keep
  6. How Spaceback does it

Two files are duplicates when their contents are identical byte for byte, whatever their names are. For photos in your Photos library, use Photos' own Duplicates album. For everything else, compare file contents with a hash, either with the read-only Terminal command below or with an app that does the same thing.

Before you spend an evening on it, know two things I found on my own Mac: duplicates usually add up to less than people expect, and on APFS some copies take no extra space at all.

Why names and sizes aren't enough

"Report.pdf" and "Report copy.pdf" might be the same file, or two drafts. Two files with different names can also be identical. When I compared files in one of my project folders, the same image turned up three times as observation-deck-detail.png, Observation-deck.png and Observation-deck-copy.png. A tool that matches names would have found one pair at best.

Equal sizes are a hint, not proof. The reliable test is a hash: a checksum computed from every byte of the file. Same hash, same contents.

Photos: use the Duplicates album

Don't go looking for duplicate photos inside the Photos library in Finder. The library is a package that Photos manages, and changing files inside it can damage it. Open Photos instead and look under Utilities for Duplicates.

Photos groups exact copies, and also photos that "appear to be the same, but may have unique resolutions, file formats, or other slight differences", in its own words. Choosing Merge Duplicates keeps one version that "combines the highest quality and relevant data" and moves the rest to Recently Deleted, so you can still get them back for a while. The space comes back when Recently Deleted is emptied.

Terminal: compare file contents

macOS has no duplicate finder for ordinary files, but Terminal can do the comparison. This computes a SHA-256 hash for every file over 1 MB in one folder and prints only the files that share a hash, in groups. It reads files and deletes nothing:

find ~/Downloads -type f -size +1M -exec shasum -a 256 {} + 2>/dev/null | awk '{n[$1]++; s[$1]=s[$1] "\n" $0} END {for (h in n) if (n[h] > 1) print s[h]}'

Replace ~/Downloads with the folder you want to check. Start with one folder rather than your whole home folder: hashing reads every byte of every file, so it takes a while. The -size +1M part skips small files, which are numerous, slow to hash and rarely worth the effort. The first time, macOS may ask whether Terminal can access the folder.

I ran it on 15 October 2026 on my MacBook Air, on the marketing folder for Spaceback: 15 GB, with 2,498 files over 1 MB. It took about a minute and found 9 groups of duplicates. The extra copies added up to 35 MB, about 0.2% of the folder.

Duplicates exist, but in that folder they weren't where the space went. Finding large files and large folders usually gives back far more for the same time.

Some duplicates take no space: APFS clones

On APFS, the file system a Mac's startup disk uses, a copy can be a clone. Apple's documentation says "A clone is a copy of a file or directory that occupies no additional space on disk." The two files share the same blocks until one of them is changed (About Apple File System). Apple's standard file-copy methods make a clone automatically when the copy stays on the same volume, so many copies you've made on one disk are clones.

I tested this on my Mac with a 300 MB file. A real copy took about 300 MB of free space, and deleting it gave about 300 MB back. A clone made with cp -c took nothing, and deleting it gave nothing back. ls and du showed all three files at about 300 MB, and all three had the same hash. You can't tell a clone from a real copy by looking at it.

So a duplicate finder's total is the most you could get back, not a promise. If the copies are clones, removing them tidies the folder and leaves the free space where it was.

Which copy to keep

Once you know two files are identical, the contents don't help you choose. The location does:

  • Keep the copy in the place you'd look for it. A file in Documents/Taxes beats the same file in Downloads or in a folder called "Archive".
  • Keep the copy an app or project points to. Two of my duplicates were the same test photo in two folders of a video project. The project needs both paths, so both stay.
  • Keep the older copy when nothing else decides it. It's usually the one you got first.
  • Leave files inside app folders, libraries and ~/Library alone. Apps keep their own copies on purpose.

Move the others to the Trash rather than deleting them outright, check that nothing complains for a few days, then empty the Trash.

How Spaceback does it

I make Spaceback, and finding duplicates is part of Pro. It works the same way as the command above: it groups files by size, compares a hash of the first 64 KB, and then confirms with a SHA-256 hash of the whole file, so names never matter. It skips files under 1 MB and starts with Downloads, Desktop and Documents, though you can point it at other folders.

In each group it suggests a copy to keep: the one with the shortest path, then the oldest. The other copies are selected for you, and you can change any of that before anything moves. What you remove goes to the Trash. Spaceback doesn't detect APFS clones, so its total counts every copy at full size. As explained above, that's the most you'd get back when you empty the Trash, not a guarantee.

Vlada Misici builds Spaceback, a storage cleaner for Mac and iPhone. Every number in these posts was measured on a real Mac, and every command was run before it went on the page. Found a mistake? Email vlada@queazy.app and it gets fixed.