Can”t install PIL after Mac OS X 10.9


I"ve just updated my Mac OS to 10.9 and I discovered that some (all?) of my Python modules are not here anymore, especially the Image one.

So I try to execute sudo pip install pil, but I get this error:

/Applications/ fatal error: "X11/Xlib.h" file not found

#      include <X11/Xlib.h>


1 error generated.

error: command "cc" failed with exit status 1

My Xcode is up-to-date and I don"t have any idea. Is it possible that PIL is not yet 10.9 compatible ?

Answer rating: 211

Following worked for me:

ln -s  /Applications/ /usr/local/include/X11
sudo pip install pil


But there is more correct solution below, provided by Will.

open your terminal and execute: xcode-select --install