Saturday, October 24, 2009

Building PIL-1.1.6 on Mac OS X 10.6

I was trying to get the Python Imaging Library installed on Snow Leopard. (This is for a "Python from python.org" environment separate from Apple standard and Macports.) I read a number of posts on the net, but it took a combination of ideas I found to arrive at a solution that worked.

Prerequisites: Install Xcode from the Snow Leopard disk. As you do that, make sure you check the box that enables continued 10.4 SDK support.

Then:

$ curl -O http://effbot.org/downloads/Imaging-1.1.6.tar.gz
$ tar zxf Imaging-1.1.6.tar.gz
$ sudo bash
# cd Imaging-1.1.6
# export ARCHFLAGS="-arch i686"
# export CFLAGS="-arch i686"
# python setup.py build
# python setup.py install
# exit

I don't like the cheap trick ("sudo bash"), but I found I needed the ARCHFLAGS and CFLAGS settings for both the build and install steps.

See also Rich Atkinson's use of pip on his blog post. That might be all you need.