FILYXA

How to find duplicate files on a Mac

Duplicate files waste space and leave you unsure which version is the real one. This guide shows how to find true duplicates reliably, and why a matching name or size is not enough.

What a duplicate is, and what it is not

A true duplicate has the same content, byte for byte. The name is irrelevant: invoice.pdf and scan-0412.pdf can be identical, while report.docx and report 2.docx can be completely different.

Matching size proves nothing either. Two photos from the same camera can be exactly the same size and still show different pictures.

Photos and Music: the built-in tools

The Photos app has a Duplicates album in its sidebar. You can merge duplicate shots there and keep their metadata.

In the Music app, File → Library → Show Duplicate Items lists duplicate tracks. Hold the Option key and the command becomes Show Exact Duplicate Items, the stricter version.

For every other kind of file, Finder has no duplicate search.

Reliable: checksums in Terminal

Terminal can condense the content of any file into a checksum. Same checksum means same content. For one folder, here Documents:

cd ~/Documents
find . -type f -exec md5 -r {} + | sort |
  awk '{n[$1]++; z[$1]=z[$1] $0 "\n"} END {for (h in n) if (n[h]>1) printf "%s", z[h]}'

The command only lists; it changes nothing. Lines sharing a checksum belong together. Decide per group which copy stays.

Careful with iCloud Drive: offloaded files exist on your computer only as placeholders. To compute a checksum, macOS downloads them first, which can take a long time and a lot of data for large folders.

Before you delete

Move duplicates to the Trash first and empty it only a few days later. Check whether one copy sits in a project or app folder that a program points to; if so, delete the other one.

When in doubt, keep the file with the more meaningful name in the more sensible place, not simply the older or newer one.

Automatic, but under your control

FILYXA detects byte-for-byte identical copies in a folder you grant it. A checksum only counts once the file has been read completely, so two offloaded files of the same size are never mistaken for the same file.

The app proposes setting the copy aside and names the original. Only what you tick gets moved, nothing is ever deleted, and every run can be undone. Free, with no subscription and no in-app purchases.