My ISP has upgraded the server to Apache 2.4.9 from 2.2.xx. It has broken a couple things in my setup and I want to bring my local copy of Apache 2.2.26 to 2.4.9 so that I can test locally.

I've been trying to find some information online, but I can’t seem to find a step by step instructions on how to do it, and mostly I find recommendations of NOT doing it. Instead I find people suggesting Homebrew, MacPorts, or Fink.

Given that I have a number of sites working with local.xxxx.com and it all works well (edit locally, test by visiting their corresponding url with the local. prefix) and it is all pretty convenient and nice, I would like to continue doing the same, but with Apache 2.4.9. Any advice as to what's the best way to do this, or a pointer to instructions would be greatly appreciated.

  • Current version of ampps.com includes Apache 2.4.7
    – Sergei
    Commented May 12, 2014 at 11:40

2 Answers 2


If you succeed, you will break part of the System

You don't want to do that. Apache2 is part of the OS. If you somehow achieve what you are after, you will break any ability to upgrade Apache2 or have any security updates Apple roles out that is applied using the built-in Mac App Store or softwareupdate from Apple. You should leave it be and install a different Apache2. Also, that way you will be assured that subsequent Apple updates also do not break your upgraded version of Apache2, which is just as likely (if not inevitable).


MacPorts is a robust, stable, mature and easy to use package management solution, for OS X. It is modeled after FreeBSD's ports system, which has been adopted as the basis of NetBSD's pkgsrc. I highly recommend MacPorts.

install Xcode 5.1.1

MacPorts requires an appropriate version of xcode; xcode_5.1.1.dmg is the most recent version for Mavericks (after registerring for a free developer account, and logging into developer.apple.com, that link will begin your xcode download). Once the download completes:

 hdiutil attach -quiet -noverify -nobrowse -noautoopen ~/Downloads/xcode_5.1.1.dmg
 cp -npR /Volumes/Xcode/Xcode.app /Applications/
 hdiutil detach -quiet /Volumes/Xcode
 open -g /Applications/Xcode.app
 sleep 8
 killall Xcode.app

Install MacPorts

Get to know MacPorts

 curl -Ok https://distfiles.macports.org/MacPorts/MacPorts-2.2.1.tar.bz2
 tar xf MacPorts-2.2.1.tar.bz2
 cd MacPorts-2.2.1
 sudo make install     # *not war!*
 cd ..
 rm -rf Macports-*
 sudo /opt/local/bin/port -v selfupdate
 diskutil quiet repairPermissions /

add MacPorts to your $PATH:

 export PATH=/opt/local/bin:/opt/local/sbin:$PATH
 export MANPATH=/opt/local/share/man:$MANPATH

install Apache 2.4.9

 Jose@stack:~$ port info apache24-devel
  apache24-devel @2.4.9 (www)
  Variants:       eventmpm, openldap, [+]preforkmpm, universal, workermpm

  Description:    Apache is an HTTP server designed as a plug-in replacement for the NCSA server version 1.3
                  (or 1.4). It fixes numerous bugs in the NCSA server and includes many frequently requested
                  new features, and has an API which allows it to be extended to meet users' needs more
  Homepage:       http://httpd.apache.org/

  Library Dependencies: apr, apr-util, expat, openssl, pcre, perl5, zlib
  Platforms:            darwin, freebsd, openbsd
  License:              Apache-2
  Maintainers:          [email protected], [email protected], [email protected],
                        [email protected]
 Jose@stack:~$ sudo port -vsc install apache24-devel

That's really all there is to it. If you can configure httpd.conf, you can do this too. And you can keep it updated to the nosebleeding edge simply with:

 sudo port -vsc selfupdate
 sudo port -vsc upgrade installed

MacPorts will not interfere with the use of OS X internal Apache2 server, nor with any other software. It keeps everything it installs in its /opt directory.

If for whatever reason you are unsatisfied and/or need to remove MacPorts:

to completely uninstall MacPorts

 sudo port -dfp uninstall --follow-dependencies installed
 sudo port -dfp uninstall all
 sudo rm -rf /opt/local  
 sudo rm -rf /Library/Tcl/macports*
  • These seem to me the most complete set of steps. I have started with the link "know MacPorts" and first run xcode-select --install (which installed command line utilities, after I had installed XCode). Next I downloaded the .pkg as per the instructions on the MacPorts site and carried on with the sudo /opt/local/bin/port -v selfupdate followed by the diskutil quiet repairPermissions / I then skipped adding to the PATH (it seems the installation did that for me). The whole process took a while with one dialog popping up asking for "javac," needing Java SE 6, which I declined.
    – Jose
    Commented May 12, 2014 at 13:21
  • Perhaps the MacPorts docs need updating. Its not a huge team of maintainers, which is one reason I have taken it upon myself to evangelize about it: the more adopters, the better it will be. I've been using it for almost 8 yrs, and I'm no programmer/developer. Once familiar with syntax (which I was a bit from using NetBSD and pkgsrc) it begins to get useful. Migration is a breeze, "port list requested" tells you all the ports you asked for, and you can script that list easily on a new system. Love rolling my own software everywhere I go. Visit #macports @freenode irc for realtime support.:D
    – chillin
    Commented May 12, 2014 at 14:10
  • Now, this seems to work, but the browser appears to still go to the 2.2.26 version of Apache. In the command line, though, running "apachectl" seems to be looking in the right place. At the moment is giving me an error [Syntax error on line 53 of /opt/local/etc/apache2/extra/httpd-vhosts.conf: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration] but that's because I haven't got the module for php loaded, which I will try to figure next. So how do I "turn off" the 2.2.26 and make sure that a local.xxxx.com request uses 2.4.9?
    – Jose
    Commented May 12, 2014 at 15:01
  • Figured how to turn it off: sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist.
    – Jose
    Commented May 12, 2014 at 15:28
  • @Jose the macports version is controlled similarly. hard to read but good stuff in there, including launchctl command to start/stop apache2, & I think you can also use apachectl, but may have to configure for the macports version of that cmd as well. Everything should be in /opt like /opt/local/apache2/conf/httpd.conf
    – chillin
    Commented May 12, 2014 at 16:45

You can upgrade the Apache that comes with Maverics but there is a big chance that every time you install a system update the Apache will break.

It's pretty easy to use homebrew, but it's a command line thing. With homebrew you can pin point the Apache version.

If you want a solution with a graphical interface use MAMP, it's free. But you will need to use the Apache version they ship (2.2.26).

I will stay away form macports, homebrew is the new king in town.

To install homebrew type this on the terminal

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Installing a specific version is more trick, you can see the instructions on this stack exchange post:


But I'm wondering what kind of problem you are getting, Apache version changes normally don't break anything, are you sure is a Apache thing? The problem can be because of another technology, like PHP, Ruby...

Would you please post the errors you are getting.

  • The error I get on visiting local.xxxxx.com is an Internal Server Error. Checking in the console, I see this:[Mon May 12 13:38:18 2014] [alert] [client] /Users/jose/Sites/local.xxxxx.com/html/.htaccess: RewriteRule: unknown flag 'END'. Rather than working around that, I would prefer to simply have my system running with 2.4.9 so that I can have as close a local setup as possible to the ISP's setup
    – Jose
    Commented May 12, 2014 at 12:40
  • I moved away from MAMP a few years back because their support for the latest (stable) versions of some packages was lacking. And I just checked, and sure enough, with their latest release, they are still on Apache 2.2.26. Going to see if Homebrew covers an easy installation of Apache 2.4.9 and PHP 5. Will check the link provided.
    – Jose
    Commented May 18, 2014 at 16:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .