Building PIL on OS X: Snow Leopard

Published on Feb. 25, 2010, 3:40 p.m.

There are several places online that discuss problems installing PIL on Mac OS X Snow Leopard

This is how I got it to work.

  1. Install lib jpeg using homebrew (which is super-aweseome!)
    brew intall jpeg
    .This installs the library into

  2. Install libfreetype the old-fashioned way (./configure, make, sudo make install). I used freetype-2.1.10.pre-20050511.

  3. Download, unpack PIL (I used Imaging-1.1.6). I had to make the following changes to
    FREETYPE_ROOT = "/usr/local"
    JPEG_ROOT = ("/usr/local/Cellar/jpeg/7/lib", "/usr/local/Cellar/jpeg/7/include")

  4. Then, build PIL:
    python build_ext -i

  5. If the build works without any errors, you can run the tests:
    which should yield the following: 57 tests passed.

  6. (optional) I like to use virtualenv, so I activate that:
    workon myproject

  7. Install PIL:
    python install

At this point, code like the following works for me:
import Image
im ="/path/to/pretty/picture.jpg")

comments powered by Disqus