Home  â€º  Articles

How to Find Duplicate Files on a Mac

Updated 2026-09-07  Â·  3 min read

Two files with the same name aren't necessarily duplicates, and two files with different names might be byte-for-byte identical. Finder's search only sees the first case.

Why Finder search isn't a duplicate finder

Searching for a filename in Finder returns files that share that name, or that share text somewhere in the file. It has no concept of content matching. A photo saved twice as IMG_4021.jpg and vacation_photo.jpg is invisible to it, and a real duplicate. Two entirely different spreadsheets that both happen to be named budget.xlsx will show up as a false match.

The Terminal way: hashing

A cryptographic hash turns any file into a short fixed string, and identical content always produces an identical hash, regardless of filename or location. Two files with the same hash are duplicates, full stop.

To hash every file in a folder and list ones that match:

find ~/Downloads -type f -exec md5 -r {} \; | sort | uniq -w 32 -D

The -r flag puts the hash first on each line, ahead of the filename, which is what makes the next part work. sort groups matching hashes together, and uniq -w 32 -D prints every line where the first 32 characters (an MD5 hash is always 32) repeat. What's left is pairs of files with identical content, regardless of what they're named or where they sit inside the folder.

Where this gets slow and risky Hashing works, but scale it to Documents, Downloads, Desktop, Pictures and Movies together and you're waiting minutes for a full pass, then manually deciding which copy of each pair to keep and which to delete. One typo in a delete command aimed at the wrong file in that list, and there's no undo.

What a real duplicate scan needs to get right

Full MD5 comparison across every folder that matters, with review before delete

CleanMachine's Duplicate Finder hashes files across Documents, Downloads, Desktop, Movies, Pictures and Music at once, and shows you every match before anything is removed. Free to scan.

↓ Download Free & Scan

Photos specifically are their own case, near-duplicates like burst shots and slight crops don't hash the same even when they're visually redundant. That needs a different approach, covered in finding duplicate photos.

Common questions

Does Finder have a duplicate file finder?
No. Finder search matches filenames and file contents as text, it doesn't compare files byte-for-byte, so it misses renamed duplicates and can falsely flag unrelated files that share a name.
How do I find duplicate files on a Mac using Terminal?
Hash files with md5 -r, which puts the hash first on each line, then sort and compare: find ~/Downloads -type f -exec md5 -r {} \; | sort | uniq -w 32 -D lists files whose content hash matches another file's, meaning they're true duplicates regardless of filename.
Is it safe to delete files a duplicate finder flags?
Only after reviewing the match yourself. Hash-based matching is extremely reliable, but any deletion should show you both files before removing either one, since a script running unattended has no way to know which copy you'd rather keep.
Can two files have the same name but not be duplicates?
Yes, this is common. Two unrelated spreadsheets both named budget.xlsx, or two photos both named IMG_4021.jpg from different cameras, share a name with completely different content. Name matching alone produces false positives.

Keep reading