Create a gist now

Instantly share code, notes, and snippets.

Compile mod_perl for Apache 2.4 on Mac OS X 10.10 Yosemite
#!/usr/bin/env bash
# Compile mod_perl for Apache 2.4 on Mac OS X 10.10 Yosemite
# http://blog.n42designs.com/blog/2014/10/23/compiling-mod-perl-for-apache-2-dot-4-on-os-x-10-dot-10-yosemite/
# NOTE: make sure you have XCode 6.1 & Command Line Tools installed first
# ask for password up front
sudo -v
# get modperl source
mkdir perltmp
cd perltmp
svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ mod_perl-2.0
cd mod_perl-2.0
# tell compiler where to find some headers and create some symlinks to required files in XCode
/usr/bin/apr-1-config --includedir /usr/include/apr-1
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apache2 /usr/include/apache2
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apr-1 /usr/include/apr-1
# compile and install (note we have to tell the compiler to use gnu89 mode instead of default C99 mode. CREDIT: http://blogs.perl.org/users/jason_a_crome/2012/04/compiling-mod-perl-2-on-os-x-lion.html)
perl Makefile.PL MP_CCOPTS=-std=gnu89 ; make ; sudo make install
# clean up
cd ../..
rm -rf perltmp
echo ""
echo "####################"
echo ""
echo "Complete!"
echo ""
echo "Add 'LoadModule perl_module libexec/apache2/mod_perl.so' to your /etc/apache2/httpd.conf file"
echo "Then restart apache (sudo apachectl configtest && sudo apachectl restart)"
echo ""
echo "####################"
echo ""
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment