Skip to content

Instantly share code, notes, and snippets.

@seancoyne
Created October 24, 2014 18:00
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save seancoyne/442fe1ab7067c3b5ff35 to your computer and use it in GitHub Desktop.
Save seancoyne/442fe1ab7067c3b5ff35 to your computer and use it in GitHub Desktop.
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
@jackdeguest
Copy link

Really good documentation and this has helped me, thank you kindly.
One small typo I have just spotted: the 'make install' will install mod_perl.so actually under /usr/libexec/apache2 (not directly under /usr/libexec). This is actually mentioned correctly a few lines lower when you indicate the line to add to the httpd.conf file:
LoadModule perl_module libexec/apache2/mod_perl.so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment