What is Mail Deduplicate?
Provides the mdedup CLI, an utility to deduplicate mails from a set of boxes.
Features
- Duplicate detection based on cherry-picked and normalized mail headers.
- Fetch mails from multiple sources.
- Reads and writes to
mbox,maildir,babyl,mh,mmdfandemlformats. - Deduplication strategies based on size, timestamp, file path or random choice, chainable as fallbacks.
- Copy, move, delete or hardlink the resulting set of duplicates.
- Dry-run mode.
- Protection against false-positives with safety checks on size and content differences. Two mails sharing every hashed header but not their body are left alone, while their real duplicate is acted on, here by
mdedup --strategy discard-matching-path --regexp old --action delete-discarded --dry-run new.mbox old.mbox: - Optional cache reusing the hashes computed by previous runs.
- Parallel hashing and selection over several processes.
- Supports macOS, Linux and Windows.
- Standalone executables for Linux, macOS and Windows.
- Shell auto-completion for Bash, Zsh and Fish.
Installation
All installation methods are available in the documentation. Below are the most popular ones:
Try it now
uv is the fastest way to run mdedup on any platform, thanks to its uvx command:
$ uvx --from mail-deduplicate -- mdedup
macOS
mdedup is part of the official Homebrew default tap, so you can install it with:
$ brew install mail-deduplicate
Executables
Standalone binaries of mdedup's latest version are available as direct downloads for several platforms and architectures:
| Platform | arm64 |
x86_64 |
|---|---|---|
| Linux | Download mdedup-linux-arm64.bin |
Download mdedup-linux-x64.bin |
| macOS | Download mdedup-macos-arm64.bin |
Download mdedup-macos-x64.bin |
| Windows | Download mdedup-windows-arm64.exe |
Download mdedup-windows-x64.exe |
Quickstart
Duplicate mails pile up whenever boxes get copied around: backups of the same account taken at different times, per-folder exports where a mail tagged with several labels lands in several boxes, archives consolidated from multiple clients, or IMAP synchronizations gone wrong.
mdedup cleans this up. Point it at your boxes: it groups copies of the same mail by hashing a curated set of headers, applies a --strategy to pick which copy to keep in each group, then performs an --action on the result. The default action is the safest one: sources are only read, and the deduplicated selection is written to a brand new box.
So to merge two overlapping archives, 2024.mbox and 2025.mbox, into a single clean box, keeping the copy each mail has in the older one:
$ mdedup --strategy select-matching-path --regexp 2024 --export merged.mbox 2024.mbox 2025.mbox
Mails found in both archives are copied once into merged.mbox, along with all the mails that were unique to each source. Backups usually leave copies byte-identical, which no date or size strategy splits apart: select-one then keeps an arbitrary copy of each mail.
To remove duplicates in place instead, switch to a destructive action, and rehearse with --dry-run:
$ mdedup --strategy select-matching-path --regexp 2024 --action delete-discarded --dry-run 2024.mbox 2025.mbox
The trail names each mail the run would delete, and alters nothing.
The hands-on tutorial builds a small playground of duplicated mails, then walks through strategies, actions and safeguards on it. The design page explains how duplicates are detected.
You can support this project with pull requests, business support 🤝 and sponsorship 🫶.
Metadata
Release files for mail-deduplicate 9.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mail_deduplicate-9.5.0.tar.gz | 148.8 kB | With provenance | Details for mail_deduplicate-9.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mail_deduplicate-9.5.0-py3-none-any.whl | Python 3 | none | any | Details for mail_deduplicate-9.5.0-py3-none-any.whl |
Total release size: 236.3 kB
Release files / mail_deduplicate-9.5.0.tar.gz
| Download URL | mail_deduplicate-9.5.0.tar.gz |
|---|---|
| Size | 148.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a4499b285a3fc272a20f626450aa14fb56a56afc1766ba1baf69e42e42b1a70
|
|
BLAKE2b-256 checksum How to use checksums |
95aea0cf07f5c0dcc1c6f763fd3a09504c552a86be70a179d4031fac3fef0621
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / mail_deduplicate-9.5.0-py3-none-any.whl
| Download URL | mail_deduplicate-9.5.0-py3-none-any.whl |
|---|---|
| Size | 87.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a3b43678ed4ab04a0125d2c0d3963a46ab48b550f07796253790e4653f7eff9
|
|
BLAKE2b-256 checksum How to use checksums |
e3eae6f08da3ba08c49c4c88c748ebe6e6d53570e6e7fc39ba0b09cf157e6543
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for mail-deduplicate 9.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mail_deduplicate-9.5.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.