Xlib.h not found when building graphviz on Mac OS X 10.8 (Mountain Lion)

After installing XQuartz you may add a symlink to your X11 installation folder by just entering

ln -s /opt/X11/include/X11 /usr/local/include/X11

in terminal. That will fix the problem as well without changing any ruby script.


You need to tell the tkstubs build (and possibly other bits in the package as well) to look for headers in /opt/X11/include; this is not on the standard include path.

Usually this is achieved by passing -I/opt/X11/include as an additional compiler flag, the method to do so is however dependent on the build system.

For reasonably modern configure scripts, the best approach is to pass it in the environment variable CPPFLAGS; if the package uses another build system or this doesn't work for another reason, then you need to look at the Makefile in the build directory.