09 May 2009

Building PIL with JPEG support under MacOS X

Getting the Python Imaging Library (v1.1.6) working in MacOS (Leopard) took a bit too much reading for my liking, so here’s how I did it.

First off you’ll need to get yourself the libjpeg source. Basically, Follow this guide to get libjpeg installed. It’s not quite that simple though: when you run .configure, you’ll need to get it to actually give you your libraries:

./configure --enable-shared --enable-static

You’ll find the libraries in /usr/local/lib, should you need them.

You’ll probably hit an error on the “make install” step, which is fixed with this:

mkdir -p /usr/local/man/man1

Then you should be able to download PIL and untar it. Go into the directory and run:

sudo python setup.py build

And then:

sudo python setup.py install

That should do it.