MacOS – Install Apache Module X-Sendfile

apachemacosxcode

I wanted to install the Apache-Module X-Sendfile as shown in http://elivz.com/blog/single/mod_xsendfile/ on my Mac OS X 10.9 (Mavericks) setup.

After downloading and unpacking the files, I've used the command sudo apxs -cia mod_xsendfile.c to run the install.

After fixing the Error "Not a directory" by creating a symlink (shown in this answer), a new problem occured :

lduer:mod_xsendfile-0.12 lduer$ sudo apxs -cia mod_xsendfile.c
Password:
/usr/share/apr-1/build-1/libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/include -I/usr/include/apache2  -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o mod_xsendfile.lo mod_xsendfile.c && touch mod_xsendfile.slo
env: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc: Not a directory
apxs:Error: Command failed with rc=65536

I haven't found any solutions by searching the web with the error code.

Edit 2013-12-13: I want to mention that the requested Path where the Error Not a directory occured (env: /Applications/[...]/bin/cc)is a symlink, linking to the file "clang" in the same directory. Maybe this helps to answer the question.

Best Answer

Here's how I installed the module:

  1. Download source code from [mod_xsendfile github repository)[https://github.com/nmaier/mod_xsendfile/releases]
  2. Install a newer Apache via homebrew, i.e. brew install httpd (note: it will not remove or damage your current, Apple-provided apache install)
  3. Go to sbin in apache dir, i.e. /usr/local/Cellar/httpd/2.2.23/sbin
  4. Compile the module (as fat-module variant):

    ./apxs -cia -Wc,"-arch i386 -arch x86_64" -Wl,"-arch i386 -arch x86_64" /path/to/mod_xsendfile.c
    
  5. Restart apache.