If you are on Lion, using the newest XCode, then a potential problem for you is that they moved the location of the developer SDKs. Packages that expected them to live in /Developer/ would no longer find them as needed.

Reference this article about specifics:
http://www.agile-workers.com/web/2012/03/qt-qmake-osx_sdk-xcode/

But in summary, what you might need to do is run:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
to point at the new location.

A manual fix might be to just symlink the SDK from /Applications/Xcode.app/Contents/Developer/... => /Developer/..., but I would first try the xcode-select tool.

Update: Some more suggestions based on your new updates

First off, I can't tell from what you posted whether PIL failed to build because of the SDK or not. If it built successfully, and you are using the standard apple python, then chances are the homebrew python path is not in your own python path.

$ python
>>> import sys
>>> sys.path.append("/usr/local/lib/python2.7/site-packages")
>>> from PIL import Image

If that still errors, then I suppose the issue is still related to missing SDK location. You could symlink the new location of the SDK to the old one with:

mkdir -p -v /Developer/SDKs
ln -s /Applications/Xcode.app/Contents/Developer/MacOSX10.6.sdk  /Developer/SDKs/MacOSX10.6.sdk

Or, you can try explicitly setting the the sdk path when you build pil:

brew remove pil
export SDKROOT=/Applications/Xcode.app/Contents/Developer/MacOSX10.6.sdk
brew install pil

Easy solution:

  1. install Homebrew
  2. brew install pillow

:)