TheCleanDisk

How to find and remove duplicate files on a Mac

Published · 6 min read · By the TheCleanDisk team

Short answer

macOS has no general duplicate finder, but it has three partial ones: Photos has a Duplicates album (macOS Ventura and later), Music has File › Library › Show Duplicate Items, and a Finder search sorted by name and size reveals likely copies. To be certain two files are identical, compare a checksum in Terminal. Always keep one copy, and back up first.

Duplicate files build up quietly: the same installer downloaded twice, photos imported from two devices, a project folder copied "just in case". They are easy to create and slow to find by hand. Here are the methods built into macOS, and how to make sure a file really is a copy before you delete it.

1. Duplicate photos and videos in Photos

  1. Open Photos and click Duplicates under Utilities in the sidebar. It appears once Photos has finished checking your library.
  2. Review each set. Photos shows exact copies and photos that look the same but differ in resolution or details.
  3. Click Merge. Photos keeps the highest-quality version, combines captions, keywords and favorites, and moves the rest to Recently Deleted.

Don't remove photos from inside the Photos Library in Finder; always use the Photos app.

2. Duplicate songs in Music

In Music, choose File › Library › Show Duplicate Items. Hold Option and choose Show Exact Duplicate Items to see only songs with the same name, artist and album. Delete the extras from the library, and choose to move the files to the Trash if Music asks.

3. Likely duplicates in Finder

  1. Open a Finder window, press Command-F and choose This Mac.
  2. Search for a file type, such as Kind is Document or Kind is Image, or a name like "copy".
  3. Choose View › as List, then sort by Name and look for matching names and sizes, or names ending in "copy", "(1)" or "2".

This finds candidates, not proof. Open both files, or confirm with the next method.

4. Exact duplicates with Terminal

A checksum is a fingerprint of a file's content: identical files have identical checksums. This command lists files over 1 MB in Documents whose content appears more than once. It only reads; it doesn't change anything.

find ~/Documents -type f -size +1M -exec md5 -r {} + 2>/dev/null | sort > ~/dupes.txt
cut -d' ' -f1 ~/dupes.txt | uniq -d > ~/dupe-codes.txt
grep -F -f ~/dupe-codes.txt ~/dupes.txt

Each group of lines that starts with the same long code is a set of identical files. Change ~/Documents to another folder to check it, and delete ~/dupes.txt and ~/dupe-codes.txt when you're done.

Which copy to keep

Where TheCleanDisk helps

TheCleanDisk's Duplicates tool checks files byte by byte, so it only lists exact copies, and it always keeps at least one copy of each set. Nothing is selected for you, and anything you remove waits in quarantine for 7 days. It is free on the Mac App Store.

Common questions

Does macOS have a duplicate file finder?

Not for all files. Photos can find duplicate photos and videos, and Music can show duplicate songs. For documents, downloads and other files you need Finder searches, Terminal or a dedicated app.

Are files with the same name always duplicates?

No. Two files can share a name and differ in content, or have different names and be identical. Only a byte-by-byte comparison or a matching checksum proves they are the same.

Is it safe to delete duplicate photos on a Mac?

Use the Duplicates album in Photos and choose Merge. Photos keeps the highest-quality version and combines the details, and merged items go to Recently Deleted for 30 days.