fatal error: 'apr.h' file not found when installing x-sendfile mac os x mountain lion server

apache, apr, fatal-error, osx-mountain-lion, x-sendfile

Solution

You need to re-install the Xcode command line tools:

xcode-select --install

You'll then likely need to accept the Xcode license agreement again:

sudo xcodebuild -license

Once you've done that (as well as your symlink for the toolchain) you should be good to go.

Problem

When I upgraded my Lion Server to Mountain Lion, it seems that it removed my mod_xsendfile from apache. I followed the instructions from this web site, but got stuck with a "No such file or directory" error. With some help from google i found this page that gave me the solution to this: "sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain" Looked good, but when I try to run "sudo apxs -cia mod_xsendfile.c" I get a "fatal error: 'apr.h' file not found" error. Any ideas?

Original source