Converting Windows PST files to Mbox on your Mac

By | July 12, 2011

I am documenting here the steps I took to convert a bunch of Windows PST files to Mbox format for importing into Apple Mail. This uses freely available open source software and the command line and it is not for your average user.

There may be some cost involved in getting your hands on Xcode so you can install MacPorts. I had MacPorts already installed so I could install a number of tools I regularly use so the whole process was greatly simplified for me. If the idea of installing Xcode and Macports turns you off then look elsewhere. I believe that Xcode 4.x can be bought by anyone on the Mac App Store (4Gb download) whereas the previous version required you to register as a developer but was free.

You can also do this conversion by other methods I am sure however I am only focussing on one.

First of all you need to install MacPorts, this is well documented here http://www.macports.org/ so I am not going to rehash that here. Once MacPorts is installed it is simply a matter of installing libpst. This same software is also available on many Linux distributions and most likely many other platforms but that was not what I was setting out do, I wanted to do this conversion on my Mac.

sudo port install libpst

—> Computing dependencies for libpst

—> Fetching archive for libpst

—> Fetching libpst

—> Attempting to fetch libpst-0.6.49.tar.gz from http://aarnet.au.distfiles.macports.org/pub/macports/mpdistfiles/libpst

—> Verifying checksum(s) for libpst

—> Extracting libpst

—> Configuring libpst

—> Building libpst

—> Staging libpst into destroot

—> Installing libpst @0.6.49_0

—> Activating libpst @0.6.49_0

—> Cleaning libpst

Done !

Now, you need to have your PST files on your Mac somewhere of course. It is simply a matter of pointing readpst which is part of libpst, at those files and telling it where to dump the output. Now at this point you might want to give some thought to how you have your PST files arranged, readpst will create a new mbox file for each folder in the PST, do you really want a few hundred different mbox files ? It’s no big deal because unlike Outlook 2011, Mail (4) lets you import multiple mbox files at once, and then neatly places them under a folder tree based on the name of the folder they came from. (Seems this is not the case with Mail 5)

So, lets convert some PST’s. Just typing readpst in a terminal window should give you this.

readpst

ReadPST / LibPST v0.6.49

Little Endian implementation being used.

GCC 4.2 : Jul 11 2011 19:07:20

Usage: readpst [OPTIONS] {PST FILENAME}

OPTIONS:

-V- Version. Display program version

-D- Include deleted items in output

-M- Write emails in the MH (rfc822) format

-S- Separate. Write emails in the separate format

-b- Don’t save RTF-Body attachments

-c[v|l]- Set the Contact output mode. -cv = VCard, -cl = EMail list

-d – Debug to file.

-e- As with -M, but include extensions on output files

-h- Help. This screen

-j – Number of parallel jobs to run

-k- KMail. Output in kmail format

-o – Output directory to write files to. CWD is changed *after* opening pst file

-q- Quiet. Only print error messages

-r- Recursive. Output in a recursive format

-t[eajc]- Set the output type list. e = email, a = attachment, j = journal, c = contact

-u- Thunderbird mode. Write two extra .size and .type files

-w- Overwrite any output mbox files

Only one of -k -M -r -S should be specified

If so then we are ready to go. This thing flies by the way compared to anything else I used. A 5Gb PST file took under 15 minutes, I didn’t time it but it was not long. Here I am running over a 2Gb PST file with 4 folders.

readpst -o /Volumes/WD_1Tb_External_2.5/Mbox/Important-Offline/ /Volumes/MAC1.5Tb/PST\ Files/Important-Offline.pst

Opening PST file and indexes…
Processing Folder “Deleted Items”
Processing Folder “IT Correspondence”
“IT Correspondence” – 23725 items done, 312 items skipped.
Processing Folder “Matched with statement”
“Matched with statement” – 18 items done, 1 items skipped.
“IT Credit Card” – 354 items done, 26 items skipped.
Processing Folder “Perso”
“Perso” – 1 items done, 0 items skipped.
“Important-Offline” – 4 items done, 0 items skipped.
So the first line says
readpst -o /Volumes/WD_1Tb_External_2.5/Mbox/Important-Offline/ /Volumes/MAC1.5Tb/PST\ Files/Important-Offline.pst

Analysing the first line

run readpst and save the output (-o) to my external HD and read the PST file from Volumes/MAC1.5Tb/PST Files/Important-Offline.pst

Now when I import this into Apple Mail because I have saved the mbox files into a folder called Important-Offline the imported mbox files will look like this.

import pst

once I have moved them out of the import folder. The skipped items above are most likely digitally signed emails. Have fun.

Leave a Reply