How to find duplicate files on Mac
macOS has no single command that finds duplicate files, but the tools that come with the Mac cover most cases for free: a Finder search sorted by size, the Duplicates collection in Photos, Show Duplicate Items in Music, and one Terminal command that compares file contents. To check every folder in one step, Everything Locator has File › Find Duplicates (⇧ ⌘ D), the quickest way.
What counts as a duplicate
Three things get called duplicates, and they are not equally safe to delete.
- Same name: two files called
report.pdfin different folders. They may be different versions. - Same size: a strong hint for large files, but two files of the same length can still differ.
- Same content: every byte matches. Only these are true duplicates, whatever they are called.
Names and sizes are quick to list. Content has to be read from the disk, which is what the Terminal command and Everything Locator's duplicate finder do.
1. Everything Locator: Find Duplicates and dupe:
Everything Locator (free to try) keeps an index of every file name with its size and dates. Choose File › Find Duplicates or press ⇧ ⌘ D, and it compares the content of files that have the same size, so a copy is found even after it was renamed. It keeps one copy of each set, the newest one with a real name, and moves the rest to the Trash. Nothing is deleted outright: File › Put Back from Trash or ⌘ Z returns the files to where they were. The duplicate finder is part of the 14-day trial and of the one-time purchase.
To look before anything moves, two search functions list the candidates as you type. dupe: shows files that share a name and sizedupe: shows files that share a size, and both combine with the rest of the search syntax:
| Search | Finds |
|---|---|
dupe: | every file whose name is used more than once |
dupe: ext:pdf ~/Documents/ | PDFs in Documents that share a name |
dupe: ~/Downloads/ file: | files downloaded again under the same name in another folder |
sizedupe: size:>100mb | files over 100 MB with exactly the same size, where a duplicate wastes the most space |
sizedupe: pic: size:>1mb | pictures over 1 MB that are the same size |
sizedupe: video: | videos that are the same size |
~/Downloads/ "(1)" | " copy" | downloads with (1) or copy in the name, the marks a second copy usually gets |
Click the Size or Name column header to put matching files next to each other, press Space to preview one and ⌘ Return to show it in Finder. ⌘ ⌫ moves the selected file to the Trash. A plain dupe: is a long list, because many folders hold a file with a common name; add a type or a folder to cut it down. Files under ~/Library and other hidden folders are left out unless Include hidden files is turned on in Settings › Indexing, and for duplicates it is better left off. The rest of the syntax is in the Everything search syntax cheat sheet.
2. Finder: sort a search by size
Finder cannot compare contents, but files of exactly the same size, type and name are easy to spot once they sit next to each other.
- In Finder, press ⌘ F and click This Mac, or the folder name to stay inside the current folder.
- Set the first rule to Kind is Image, Movie, PDF or the type you want to check. One type at a time keeps the list short.
- Switch to list view with ⌘ 2 and click the Size column header. If there is no Size column, choose View › Show View Options and select Size.
- Look for neighbors with the same size. Select one and press Space to preview it, then the other, before you delete anything.
A second quick check is the name. File › Duplicate (⌘ D) in Finder adds copy to the name, and a download saved twice usually gets a number such as (1). To list them, change the first rule of the search to Name contains copy. The path bar (View › Show Path Bar) shows which folder each result is in; see how to find the path of a file on Mac.
3. Photos: the Duplicates collection
Photos finds its own duplicates. Apple's Photos User Guide says they appear in the Duplicates collection under Utilities in the sidebar, and that it can take some time for them to show up while Photos analyzes the library.
- Open Photos and click Duplicates under Utilities. If Utilities is closed, hold the pointer over it and click the arrow.
- Select the items in one row, or several rows, and click the Merge button.
Merging keeps one photo or video in the library, and the others go to Recently Deleted, where Apple says they can be recovered for 30 days. Do this inside Photos, never by deleting files from the library package in Finder; where photos are stored on Mac explains why.
4. Music: Show Duplicate Items
- Open Music and click Songs in the sidebar.
- Choose File › Library › Show Duplicate Items. Apple's Music User Guide notes that this lists every version of a song, including ones on other albums.
- To see only exact matches, hold down ⌥ and choose File › Library › Show Exact Duplicate Items.
- Delete the ones you don't want, then click Done or choose File › Library › Show All Items.
5. Terminal: compare file contents
This command only reads. It computes a SHA-256 checksum for every file over 1 MB in a folder and prints the files whose checksum appears more than once, which means the content is the same:
# sets of identical files over 1 MB in Documents
find ~/Documents -type f -size +1M -exec shasum -a 256 {} + | sort | awk '$1 == h { if (!p) print l; print; p = 1; next } { h = $1; l = $0; p = 0 }'
# check one pair: no output means the two files are identical
cmp ~/Desktop/report.pdf ~/Downloads/report.pdf
Lines that start with the same checksum are copies of each other. The command reads every file in full, so start with one folder such as Documents or Downloads, not the whole home folder, and expect a wait when the folder holds large videos. Change +1M to another size, or remove -size +1M to include small files. How to find files on Mac from the Terminal has more on find.
Before you delete a duplicate
- Leave system and app folders alone. Identical files inside
~/Library, app bundles, the Photos library and developer or project folders are usually there on purpose, because each app or project expects its own copy. - Keep the copy in the right place. The one in Documents or a project folder is usually the one to keep; the one in Downloads or on the Desktop is usually the spare.
- Use the Trash. Move spare copies to the Trash and empty it only once everything still opens. Where to find the Trash on Mac covers Put Back.
Duplicates are rarely the biggest waste of space. If the goal is a less full disk, start with how to find large files on Mac. Folders left with nothing in them after a cleanup are covered in how to find empty folders on Mac.
FAQ
Does Mac have a built-in duplicate file finder?
Not for files in general. Photos has a Duplicates collection and Music has Show Duplicate Items, but Finder has no command that compares files. For other files, sort a Finder search by size, run the shasum command above in Terminal, or use an app such as Everything Locator.
How do I find duplicate files on a Mac for free?
Use what comes with macOS: a Finder search sorted by size for a first look, the Duplicates collection in Photos, Show Duplicate Items in Music, and the Terminal command above to confirm that two files have the same content.
Is it safe to delete duplicate files on a Mac?
For your own documents, downloads, pictures and videos, yes, once you have confirmed the content is the same and you keep one copy. Leave identical files inside ~/Library, apps and the Photos library alone, and move files to the Trash so you can put them back.
How do I find duplicate photos on a Mac?
For pictures in the Photos app, open Duplicates under Utilities in the Photos sidebar and click Merge. For picture files in folders, search sizedupe: pic: in Everything Locator or sort a Finder search for Kind is Image by size.
Why do I have so many duplicate files?
The usual sources are a file downloaded more than once, an attachment saved again, File › Duplicate in Finder, and folders copied to a second place as a backup. Most of them end up in Downloads and on the Desktop, so check those first; see how to find downloads on Mac.
Find the copies you don't need
Everything Locator searches your whole Mac by name, size and date as you type, and finds duplicate files by content.