How to Find and Remove Duplicate Files on Your Mac

Updated · MintDisk team

MintDisk Duplicates showing groups of identical files on a Mac

Duplicates creep in quietly: a photo library imported twice, the same video saved to the Desktop and to Movies, downloads that end in "(1)" and "(2)", folders copied as a quick backup and then forgotten. Each copy takes the full space again. This guide shows how to find and remove duplicate files on Mac, starting with the Photos app, then Finder and Terminal for everything else.

Removing duplicates is safe only if you are sure the files really are identical and that one copy stays. The steps below check both before anything is deleted.

Back up first

Before a cleanup that touches many files, make a backup. Time Machine is built into macOS and is the simplest way to be able to undo a mistake.

  1. Connect an external drive. Apple recommends one with at least twice the storage capacity of your Mac, used only for Time Machine.
  2. On macOS 13 and later, open System Settings > General > Time Machine and add the drive as a backup disk.
  3. Choose Back Up Now from the Time Machine menu and wait for the backup to finish.

With a recent backup you can restore a file even after the Trash has been emptied.

Where duplicates usually come from

  • Downloading the same file again, which macOS saves with a number added to the name.
  • Importing photos twice, for example once from a phone and again from a camera card or a shared album.
  • Manual backups: a folder copied to the Desktop or to Documents before a big change, then forgotten.
  • Exports: videos and images exported several times while editing, each one a full copy.
  • Sync tools: when two sync services or two Macs edit the same folder, conflicted copies can appear.

Fixing the habit that creates duplicates, such as one import routine or one backup tool, keeps the problem from coming back.

Remove duplicate photos in the Photos app

For pictures and videos in your Photos library, use Photos itself. Never delete files from inside the Photos library package in Finder: the library would no longer match its database.

  1. Open Photos. In the sidebar, find the Duplicates collection (under Utilities in recent versions; on macOS 13 it appears as a Duplicates album). If you don't see it, hold the pointer over Utilities and click the arrow.
  2. Review the groups. Each row shows the items Photos considers duplicates.
  3. Select a row, several rows, or press Command-A for all, then click Merge and confirm.

Merging keeps one copy in place and moves the others to Recently Deleted, where you can recover them for 30 days. Photos may take some time to detect duplicates after a large import, so the collection can grow over a few days.

If you use iCloud Shared Photo Library, choose Both Libraries from the Library pop-up menu to see duplicates across both.

Spot duplicate files in Finder

Finder has no dedicated duplicate finder, but a few habits catch the most common cases.

  • In Downloads, sort by Name in list view. Copies saved twice usually sit next to each other as file.pdf, file (1).pdf and file (2).pdf.
  • Sort a folder by Size and look for files with exactly the same size and similar names.
  • Search for a file name with Command-F and the scope set to This Mac to find copies of one specific file in other folders.
  • Look for folders you copied as a backup, such as Project copy or Photos 2023 backup, and compare them with the original.
Finder Downloads folder sorted by name, with file.pdf, file (1).pdf and file (2).pdf of the same size next to each other
Sorted by name, copies such as "file (1).pdf" sit next to the original. Example output with demo files.

Same name and same size are strong hints, but not proof. Two files can share a name and size and still differ. To be certain, compare their contents with a checksum, as shown next.

Confirm duplicates with a checksum

A checksum is a fingerprint of a file's content. Files with the same SHA-256 checksum have the same content, whatever their names are. macOS includes the shasum command; this only reads the files.

shasum -a 256 "file.pdf" "file (1).pdf"
Terminal running shasum -a 256 on two pairs of PDFs: the first pair has the same checksum, the second pair does not
Same checksum, same content: "file (1).pdf" is a copy, "file (2).pdf" is not. Example output with demo files.

If both lines show the same long hexadecimal string, the files are identical. To check every file in a folder at once and see which checksums appear more than once:

cd ~/Downloads
shasum -a 256 * | sort | awk '{print $1}' | uniq -d

Each line of the output is a checksum that belongs to two or more files. Search for it in the full list (shasum -a 256 * | grep CHECKSUM) to see which files share it.

Checksumming large folders takes time, because every byte is read. Start with one folder rather than your whole disk.

Delete the extra copies safely

Keep one copy of every file. Before you delete, check which copy other apps or projects use: an app library, a project folder or a synced folder may expect the file in a specific place.

  1. Decide which copy to keep. Usually that is the one in the most sensible location, with the clearest name or the oldest date.
  2. Select the other copies in Finder and press Command-Delete to move them to the Trash.
  3. Open the files you kept to make sure they work, then empty the Trash to get the space back.

Duplicates inside iCloud Drive count against your iCloud storage too. Items you delete from iCloud Drive are removed from all your devices after 30 days.

Duplicates versus similar photos

Exact duplicates have identical content. Similar photos, such as burst shots or the same scene taken twice, are different files that only look alike, so checksums will not match. They need a visual comparison, and choosing which one to keep is a judgement call. Review them yourself rather than removing them automatically.

Questions and answers

Which copy does Photos keep when it merges?

Photos keeps one item where the duplicates were and moves the rest to Recently Deleted. Apple doesn't document how it picks the kept item, so review a group before merging if quality or metadata matter to you.

Are two files with the same name duplicates?

Not necessarily. Only identical content makes a duplicate. Compare checksums, as shown above, before you delete one of them.

Can I get a deleted duplicate back?

From the Trash, until you empty it. From Recently Deleted in Photos, for 30 days. After that, only from a backup such as Time Machine.

Does macOS have a built-in duplicate finder?

Photos can find duplicate photos and videos in its library. For other files there is no dedicated duplicate tool in Finder, which is why the checksum method above is useful.

Can I delete duplicates inside the Music or Photos library in Finder?

No. Libraries are databases as much as folders. Removing files from inside them in Finder leaves the app pointing at missing files. Use the app's own delete or merge option.

What about duplicates on an external drive?

The same methods work: choose the drive as the Finder search scope, or run shasum in a folder on the drive. A copy on an external drive is often a backup on purpose, though, so check before you delete it.

Let MintDisk compare file contents for you

MintDisk's duplicate file finder compares files by size, then by a sample of their content, and confirms each match with a full-content hash, so renamed copies are found too. Smart select keeps one copy of every group, and the app never deletes the last copy. Files you remove go to the Trash by default.

MintDisk Duplicates grouped by folder, each group listing identical copies of one file
MintDisk's Duplicates: identical files grouped together, and each group keeps one copy.

Related

Sources

First published . Commands and menu paths were checked against the sources above on the update date.

Ask AI assistants about MintDisk

Independent, real-time insights from major language models.