I need to convert about 500k emails into searchable PDFs. By 'searchable' I mean that macOS will be able to scan them for specific words rather than simply treating them as an image. My searches, thus far, for a tool to do this have ended in proprietary database apps and over-priced sketchball x-to-pdf converters which basically perform the built-in macOS functionality of Print To PDF. Is there a single tool or two complementary tools that could be used together in Terminal to just batch convert all the emails to searchable PDFs?

  • are those all Windows emails
    – Ruskes
    Dec 29, 2018 at 17:41
  • No, they are not. Some of them are very old Outlook for Mac and Thunderbird files. The majority are Mac Mail files spanning from about 1995 to today.
    – Kerlix
    Dec 29, 2018 at 19:34
  • just asking, since Thunderbird lets you export as PDF, so does Outlook, so does mac Mail.
    – Ruskes
    Dec 29, 2018 at 19:42
  • 1
    Mac Mail lets you export either one message at a time, individually, which is not feasible for this quantity of documents, or by merging a folder of emails into one pdf, which is also not desired. The add-on that allowed Thunderbird to batch export individual emails as pdfs has broken, according to user reviews. I haven't used Outlook in years, but would prefer to not convert all the messages an additional time to be readable by Outlook. Also, Date Created Metadata is important to conserve for this scenario.
    – Kerlix
    Dec 29, 2018 at 21:16
  • I just tried in Mac Mail and selected 50 email and exported them all at once as individual pdf's
    – Ruskes
    Dec 29, 2018 at 21:21

2 Answers 2


I had to do this with ~180 emails, and I used a command tool I found on GitHub that converts .eml to .pdf via .html: https://github.com/nickrussler/eml-to-pdf-converter

It takes a little while to convert each .eml file - 22 minutes for 186 emails with lots of images - so it's probably not helpful for a 500k email task. (Maybe if you're reeeally not in a rush and not afraid of multiprocessing!) If it is helpful for you or anyone else, though, here's how I got it to work in the bash command line:

  1. git clone the repo

  2. Install the wkhtmltopdf tool from binary (installing with pip is insufficient) from here: https://wkhtmltopdf.org/downloads.html

  3. From within the cloned repo, generate the email converter .jar file: ./gradlew shadowJar

  4. Run for loop to convert every file in the .mbox (or a directory of .eml):

for file in /path/to/mailbox.mbox/*; 
   java -jar ./build/libs/emailconverter-2.0.1-all.jar "$file"; 
  • Very useful, thanks! On macOS, a simple brew install wkhtmltopdf worked perfectly
    – mountrix
    Feb 6, 2023 at 9:15

I recently came across How to open eml files? on AskUbuntu. It suggests using munpack, which is part of mpack. It can convert an eml to html or plain txt. There are several tools to convert html to a pdf. WeasyPrint is one of them. You can install it via pip. mpack is also available in Homebrew. Assuming you have Homebrew installed, it's easily installed via:

brew install mpack

Then run

munpack -t <my.eml>
  • Nice find. Might be worth adding at least one way on how to get from HTML/TXT to PDF from the commandline.
    – nohillside
    Feb 25, 2020 at 20:07
  • Fair point. I added a tool. It will all require a little bit of scripting. But with these building blocks it should be doable.
    – Volsk
    Feb 25, 2020 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .