Sunday, December 20, 2009

libpst and readpst... the hacked way on vista / xp - fixed

So have you ever backed up your PSTs and then needed a good way to look at them. Well I have. I backed up my PSTs, and without Outlook I was a bit stuck. After checking around I found that the only free option is libpst. libpst has an executable called readpst which can open up the folders and parse your files. Problem is that libpst is written for Linux. Nobody packages a Windows friendly readpst.

I looked around to see what should work, and I didn't want to pollute my newly installed Vista with all sorts of stuff. Here are the steps I took to make readpst compile without too many installations:

Install MinGW (MinGW-5.1.6.exe), choose GCC only.
GnuWin32 tools:
Install GNU Regex for Win32 (regex-2.7-setup.exe).
Install GNU ICONV for Win32 (libiconv-1.9.2-1.exe).

Now you can compile readpst, here's the command:

From the libpst src directory run:
"c:\MinGW\bin\mingw32-gcc.exe" -DHAVE_REGEX_H -I"c:\Program Files (x86)\GnuWin32\include" -include "C:\MinGW\include\inttypes.h" -DVERSION=\"0.6.45\" -include "C:\MinGW\include\errno.h" -include "C:\MinGW\include\sys\stat.h" -include "C:\MinGW\include\limits.h" -DHAVE_ICONV -DICONV_CONST=const -L"c:\Program Files (x86)\GnuWin32\lib" debug.c libpst.c vbuf.c -liconv libstrfunc.c timeconv.c lzfu.c readpst.c -lregex -o readpst.exe

Modify your path to include 'C:\Program Files (x86)\GnuWin32\bin\;'. This is how the required DLLs will be found. Thank you to everyone who pointed out that it was missing libiconv2.dll. Since I use the GnuWin32 tools all the time I naturally had this set in my path before I had ever heard of libpst.

If you are running on a 32 bit OS then you will have to change the 'Program Files (x86)' to 'Program Files', or if you install 64 bit versions you'll have to change stuff around, and so on and so on.

If anyone has some good pointers on an easier way to compile readpst I'd love to hear it, and no I'm not interested in a full MSYS or cygwin install!

Link to readpst x32 :


  1. This is cool, but I get a missing libiconv2.dll when I try to run it.

  2. Is the specification for pst file format released ?

    Is there any parser for windows without using MAPI available or not?

  3. Anonymous:
    Check that you installed the GNU ICONV for Win32 (libiconv-1.9.2-1.exe).
    Check that you have this in the compilation command for x64:
    -L"c:\Program Files (x86)\GnuWin32\lib"
    or for x32:
    -L"c:\Program Files\GnuWin32\lib"

    I don't know, but I'm pretty sure that Microsoft said they are going to release it.

    This program does parse PST without MAPI.

  4. I'm also getting the missing libiconv2.dll error, both when I download the posted .exe and when I try compiling it myself. I have reinstalled GNU ICONV for Win32 twice but it doesn't seem to be helping. I'm running on WinXP ... do you have any ideas what might be causing the issue? I'd really like to get readpst running!

  5. I've just checked, and I think it's because my GnuWin32\bin folder is in my path. Modify your path: Go to "Environment Variables", and change System Variables Path to include:
    C:\Program Files\GnuWin32\bin\;
    Reboot your system and then run readpst.exe, this should now allow Windows to find the required DLLs.

  6. I was able to put together a package to compile using c++ 2008 Express. I didn't want to install MinGW. It compiles and runs on Windows 7 if anyone is interested. I would be happy to email the package with instructions. The only dependencies is the pcre (perl compatible regular expresions) library for windows; which is free. I had to update the source to compile in the 2008 compiler. It seems the C source code had to be brought into the 21st century.
    Email me @ mnjrupp at hotmail dot com

  7. Hi,
    I would like to compile the libpff library as well in order to build pffexport.exe file. can you tell me if i would need to follow the same procedure described as above or do i need to use another compiler type .

  8. I imagine the same type of sequences would work, but I haven't tried. Perhaps I'll have time later.

  9. Hi, for me it worked much easier way (on XP Pro).

    I've just copied:
    - readpst.exe
    - libiconv2.dll
    - regex2.dll
    to one directory and then for my convienience I've put there also the pst I wanted to read.
    The just typed readpst -u myfile.pst, then imported into thunderbird and was ready.

    Zero installing, rebooting or changes in registry. Hope this helps.

    1. This worked wonderfully for me. By far the easiest option and no compiling required.

  10. How could I compile the rest of the executables?
    Deltasearch, dumpblocks, getidblocks,lspst and ps2ldiff? Your instructions were perfect, I was able to compile 06.50 this morning with no issues, totally awesome work. I've been trying with Cygwin for about a week, but having an issue with lboost_python not linking (I guess?). Cygwin will make the files, but they don't work because it won't link :( Thanks again!

  11. Hi, does somebody see a way to compile the current version? This way unfortunately has worked only until version 0.6.55

  12. Thank you so much for this!

    I've been looking so long for a way to convert mail from a work PC (Outlook, blechh!) for import at home. I don't have Linux, so libpst (which, unbelievably, seems to be the only actual non-ripoff software out there!) was not a convenient option.

    Almost as unbelievable is that no-one else has compiled a Windows version, as far as I can tell! But with your readpst.exe and the libiconv2 and regex2 DLLs downloaded from some dodgy website (no virus so far...) I have *FINALLY* got a backup of my mail to keep at home.

    Thank you thank you thank you!