PIL on Snow Leopard

Edit: The secret to fixing this lies in Universal Binaries in Macports!

Getting the Python Imaging Library[1] working with both Python2.5 and Python2.6 on Snow Leopard proved tricky.  Using MacPorts[2], it’s pretty easy to install PIL for Python2.6.  After installing MacPorts, run the following:

sudo port install freetype jpeg tiff libpng

Once these libraries are installed, Grab the latest version of PIL and run:

sudo /usr/bin/python2.6 setup.py build install

The tricky part is getting PIL to work under Python 2.5. After a good amount of time searching for the right way to build PIL, I found a post[3] that suggested grabbing the python.org binary version[4]. So, I cheated and did just that.

After downloading the dmg, show the package contents for PIL-1.1.6-py2.5-macosx10.4.mpkg.

Show PIL package contents

Then navigate to Contents -> Packages -> PIL-platlib-1.1.6-py2.5-macosx10.4.pkg and show its package contents.

Show platlib package contents

In there you will find Archive.pax.gz. Double clicking on that file will extract the contents to an Archive directory.

Finally, copy PIL and PIL.pth over:

> cd /Library/Python/2.5/site-packages/
> sudo cp -rp ~/Downloads/Archive/PIL .
> sudo cp -rp ~/Downloads/Archive/PIL.pth .

At this point, PIL should work for both Python2.5 and Python2.6


[1] http://www.pythonware.com/products/pil/
[2] http://www.macports.org/
[3] http://tinyurl.com/yjqs5qb
[4] http://pythonmac.org/packages/py25-fat/index.html


One thought on “PIL on Snow Leopard”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s