How to remove duplicate emails from an MBOX file on a Mac

By

Mail has no duplicate finder, and its Import Mailboxes… drops repeated Message-IDs without telling you which. Here's what Mail does on its own, and how to find the copies across exported mailboxes, check them side by side and write a cleaned .mbox.

You exported your Inbox from Mail, then found an older export on the old laptop, and the two overlap. Or you imported a backup twice. Now the same invoice is in your archive three times, and you want one clean .mbox before you keep it or move it somewhere else.

The short answer: Mail on the Mac has no command that finds duplicate emails. You can sort a mailbox and delete copies one by one, and Mail’s import quietly drops some of them. To find every copy across several exported mailboxes, see why each one counts as a copy, and write a cleaned mailbox while the originals stay as they were, you need an app made for it.

Does Mail remove duplicate emails?

There’s no Remove Duplicates anywhere in Mail. The free way is by hand: import the mailbox, sort the list by subject or date, open the emails that look alike, and delete the extra ones. Then export the mailbox again with Mailbox › Export Mailbox…, which the tutorial on exporting a mailbox from Mail walks through.

For a few dozen emails that works. Two emails with the same subject aren’t always the same email, though: a weekly report or a monthly newsletter can repeat its subject every time. You have to open each pair to be sure.

Mail does drop some copies when it imports. Choose File › Import Mailboxes…, pick Files in mbox format, and choose the file or the folder. Mail needs an email account set up before it imports anything.

Mail's Import window, with Files in mbox format picked and the line You will now be asked for the location of one or more files in mbox format or a folder containing them, and the buttons Cancel and Continue

On the test Mac, Mail kept only one email per Message-ID inside each imported mailbox. The Message-ID is a label that the sending server puts on each email, and a real copy carries the same one. Mail didn’t say what it left out. A mailbox of 9 emails showed 8, because two different newsletters, the April and the May issue, had been sent with the same Message-ID, and Mail kept only one of them.

So the import is a partial cleanup, with three gaps:

  • an email that’s in two different mailboxes stays twice
  • copies that have no Message-ID at all aren’t matched
  • two different emails that share an ID lose one, with no warning

How do I find duplicates across several mailboxes?

Mailbox Duplicate Cleaner is a Mac app I made for this. It reads exported mailboxes, .mbox files and the folders Mail writes when you export, groups the copies, and lets you look at each group before it writes anything. Mail and your email account are never opened. The app isn’t made by, affiliated with or endorsed by Apple, and costs $19, paid once.

The mailboxes in these screenshots are made up: an Inbox, a Sent mailbox, and an older Inbox exported from Mail on an “Old laptop”.

How Mailbox Duplicate Cleaner makes a cleaned copyYou add exported mailboxes, .mbox files or folders exported from Mail. The app groups the copies by Message-ID and by sender, date, subject, recipients and text. Certain groups keep one copy. Groups to check keep every copy until you compare them side by side and choose. The app then writes a new folder with the cleaned mailboxes, Excluded duplicates.mbox with every copy left out, and Duplicate report.csv. The original mailboxes are only read.YesSomething differsExported mailboxes:.mbox files and MailexportsFind DuplicatesSame Message-ID andsame content?Certain: one copykeptCheck: every copykept until youchooseNew folder: cleanedmailboxesExcludedduplicates.mboxDuplicate report.csvOriginals only read

1. Add the mailboxes and choose where to save

Click Add Mailboxes… and pick the files, or drop them on the window. A folder like “Old laptop” works too: the app finds the mailboxes inside it. Then click Choose… under Save in. The cleaned copy goes into a new folder there, called “Cleaned mailboxes”.

Mailbox Duplicate Cleaner's start screen: Find the duplicate emails in exported mailboxes, with four steps, Add the mailboxes you exported, Choose where to save the cleaned copy, Find duplicates and review them, Write the cleaned copy, an Add Mailboxes… button, and the Matching options and Save in box in the sidebar

A file that isn’t a mailbox, like a single .eml email, is listed in orange with a sentence that says why.

2. Find the duplicates

Click Find Duplicates. Here the three mailboxes held 17 emails, and the app found 7 groups of copies.

Review the duplicates: 17 emails in 3 mailboxes, 5 certain groups, 2 groups to check, 5 copies left out. Invoice 2024-031 for March has 3 copies, 1 kept, Certain. Backup finished: 42 GB copied and Type Foundry News, April are marked Check, each with its reason in orange

A Certain group has the same Message-ID and the same content on every copy, so it keeps one. A Check group keeps every copy and says what doesn’t line up. This is what the sample came to:

EmailCopiesWhat the app did
Invoice 2024-031 for MarchInbox twice, Old laptop onceCertain, kept 1
Café menu proofs, round 2Inbox, Old laptopCertain, kept 1
Re: Kickoff meeting notesInbox, Old laptopCertain, kept 1
Quote for the spring catalogueSent twiceCertain, kept 1
Photos from the offsiteSent, Inbox (you were on Cc)Kept both, a sent and a received copy
Backup finished: 42 GB copiedInbox twice, no Message-IDCheck, same text and date
Type Foundry News, April and MayInbox, one shared Message-IDCheck, different dates and text

The last row is the newsletter that Mail’s import merged. Here it’s flagged, and both issues stay unless you untick one.

3. Compare the copies you’re unsure about

Click a group to open its copies side by side. The backup report has no Message-ID on either copy, but the sender, date, subject, recipients and text are the same, and the only header that differs is Received, which changes each time an email is delivered or imported. That’s a real copy, so here copy 2 was unticked.

The Backup finished: 42 GB copied group open, Copy 1 and Copy 2 side by side: Message-ID None on both, the same From, To, Date and Subject, Text and attachments Same as copy 1, sizes 458 and 460 bytes, Other headers that differ Received. Copy 1 has Keep ticked, Copy 2 doesn't, and the bottom bar reads Writes 11 emails and leaves out 6 copies

4. Write the cleaned copy

Click Write Cleaned Copy. The new folder has one cleaned mailbox for each one you added, Excluded duplicates.mbox with the 6 copies left out, and Duplicate report.csv with one row for every copy in a group, kept or excluded. The original mailboxes are only read.

The Done screen: Your cleaned copy is ready, 11 emails kept and 6 copies left out. Inbox.mbox 8 emails kept, Inbox (Old laptop).mbox 1, Sent.mbox 2, Excluded duplicates.mbox 6 copies, Duplicate report.csv 15 rows, and a tip about importing them into Mail

To read the result in Mail, import the new folder with File › Import Mailboxes… and Files in mbox format. If you kept both newsletter issues, Mail still shows only one of them, because of the Message-ID rule above.

Mail or the app?

By hand in MailMail’s importMailbox Duplicate Cleaner
Finds the copiesYou compare them one by oneOnly repeated Message-IDs in one mailboxEvery group, in every mailbox
Copies without a Message-IDIf you spot themKeptMatched on sender, date, subject, recipients and text
Different emails with one IDYou decideOne is droppedFlagged, both kept until you choose
Record of what was removedNoneNoneA CSV and a mailbox of the removed copies
Your exported filesUnchangedUnchangedUnchanged, the result is a new folder

For a handful of copies in one mailbox, sorting in Mail is enough. When two or three exports overlap, or you need to show someone what was removed, the app does the comparing and keeps a record. It works on exported mailboxes only, and it was tested with made-up mailboxes, not with real exports from Gmail, Thunderbird or Outlook.

Get Mailbox Duplicate Cleaner

Find the duplicate emails in .mbox files and mailboxes exported from Mail, compare the copies side by side, and write a cleaned copy with every removed copy kept aside and a CSV of each decision. The originals are only read.

See Mailbox Duplicate Cleaner → · Read the docs · $19. See the app page for tax details.

More tutorials for my apps →

Want me to talk about your product? You can sponsor this site.