How to find duplicate files on a Mac
The same file often lands on a Mac more than once: a PDF downloaded twice, an export saved to two folders, a project folder copied "just in case". To find duplicate files on a Mac reliably, you compare what's inside the files, not their names.
The short answer: macOS has no duplicate file finder. Finder can't compare contents, and the Duplicates album in Photos only covers the Photos library. The reliable free way is Terminal: compute a checksum of every file in a folder with shasum and list the files whose checksums match. Before you delete anything, know that copies made in Finder on an APFS disk are often clones that share storage, so deleting one can free almost nothing. Delete copies in Downloads and your own folders; leave duplicates inside apps, ~/Library, the Photos library and code projects alone.
Does Finder have a duplicate file finder?
No. Finder can only help you spot likely copies by name and size:
- Open Downloads in list view and sort by Name: a second download of the same file usually gets a number, such as
report (1).pdf, and Finder's Duplicate adds "copy" to the name. - Choose File › New Smart Folder, then add rules for Name and File Size to collect files that look alike from the whole Mac.
Both are guesses. Two files with the same name and size can differ, and the same file can live under two different names. Only a content check tells you for sure.
How do I find duplicate files in Terminal?
This lists every file over 1 MB in Downloads whose content matches another file, in groups, with a blank line between groups. It only reads files; it never deletes or changes anything:
find ~/Downloads -name '*.app' -prune -o -type f -size +1M -exec shasum -a 256 {} + 2>/dev/null | sort | awk '$1 == h { if (!p) print prev; print; p = 1; next } { if (p) print ""; h = $1; prev = $0; p = 0 }'
- Replace
~/Downloadswith any folder, for example~/Documentsor a folder on an external drive. Change+1Mto+100Mto look only at big files. - It reads every file in full, so a big folder takes a while. The first time, macOS may ask whether Terminal can access the folder.
- If Desktop and Documents are in iCloud Drive with Optimize Mac Storage on, reading a file that's only in iCloud downloads it first. Run it on folders whose files are on the Mac.
To double-check one pair before you delete, compare the two files byte by byte. No output means they're identical:
cmp ~/Downloads/"report (1).pdf" ~/Documents/report.pdf
Why didn't deleting a duplicate free any space?
On APFS, the format of a Mac's startup disk, Finder's Duplicate (Command-D) and copies made within the same disk are usually clones. A clone shares its storage with the original until one of them changes. Finder shows the full size for both, but deleting one gives back only the parts it doesn't share, which for an unchanged clone is next to nothing. A file you downloaded twice, or copied from another disk, is a real second copy and does take its own space.
Space also comes back only after you empty the Trash.
Which duplicate files are safe to delete?
- Safe to review: Downloads (installers and documents downloaded twice), exports and renders saved more than once, and copies of your own files on the Desktop or in Documents. Keep one copy, check it opens, then move the others to the Trash.
- Leave alone: files inside apps (
.appbundles), anything in~/Library(apps keep identical files on purpose), and the Photos library package. To clean up photos, see How to delete duplicate photos on a Mac. - Code projects and git repositories: identical files across
node_modulesfolders are normal, and deleting files inside a repository breaks it. Remove the whole rebuildable folder instead: How to find and delete old node_modules folders and package caches on a Mac.
Which copy should I keep?
When the content is identical, keep the copy in the folder where you'll look for it, usually not Downloads. The oldest copy is usually the original. If you keep files in iCloud Drive, deleting a copy there deletes it on your other devices too. For more ways to make room, see How to free up space on a Mac.