Local Web Development With OS X Mavericks

I recently wrote a guide for setting up a great web development environment on your Mac, which was written with OS X 10.8 (Mountain Lion) in mind. With the release of Mavericks, I expected there would be adjustments to be made for the instructions. I’m very pleased to report that my guide for 10.8 works flawlessly with Mavericks, so I have no need to make changes.

If you’ve followed my guide, or have created your own method to set up a multi-site environment for local web development, you will probably find, upon upgrading to Mavericks, that your localhost has stopped working. Do not fear. You may need only to take one step to rectify the issue.

When the Mavericks updater runs, it replaces your carefully edited Apache configuration file with the default one, which will wipe out any changes you have made. The good news is that someone at Apple was kind enough to back up your Apache configuration files for you.

Running the following commands will restore your pre-upgrade Apache configuration, and restart apache:

sudo cp /etc/apache2/httpd.conf.pre-update /etc/apache2/httpd.conf
sudo apachectl restart

This alone should restore your settings, and kick start your old environment under Mavericks.

If you have not yet upgraded, I would encourage you to first make your own backup of your config file, just in case your upgrade fails, and you need to start from scratch.

26 Responses

  1. Lionel

    You rock dude. Installed Mavericks this morning and found my localhost didn’t work. I spent many hours fixing this issue in the past with upgrades but your post had me up and running in less then 1 minute. Thanks.

  2. Stefan Pretty

    First of all, thanks, doing some pre-upgrade research before I take the leap! Second of all. Love your blog design. Love the parallax header image. Good job.

    - Stefan Pretty

  3. Dan Cowell

    Hi Chris, thanks for posting this followup. It seems it’s an imperfect backup, since my httpd.conf.pre-backup didn’t include the changes – it was the default httpd.conf. I’d highly recommend a manual backup to anyone attempting an upgrade to Mavericks.

  4. Doru Davidson

    Thank you! Such a timesaver! Forgot I did the same thing when upgraded to Mountain Lion. I guess I either need to bookmark this post, or document it in my notes for next time…. :-)

  5. Chris Mallinson

    Hi Dan, That’s really strange your backup was not correct. Is it possible that the install ran twice? Another thing that’s been brought to my attention is that although the main httpd.conf file is backed up, any changes you make to the default included files in the etc/apache2/extra/ folder are not backed up.

    As you said Dan, it’s always a good idea to back up your Apache config, even if you’re not upgrading. I also like keeping my virtual host configs and some other things in separate config files, and I do not use the default ones provided with Apache. Giving them new names should prevent rewriting by the installer. But backup anyway. Use Time Machine, and make sure you keep important files backed up offsite.

  6. Steve

    Awesome! I was thinking I’d have to go through the whole process, but this one step worked flawlessly for me! Thanks so much!

  7. Dennis

    Additional files preserved by Marvicks install:
    /etc/apache2/httpd.conf~previous
    /etc/group~previous
    /etc/php.ini.default-5.2-previous
    /etc/sshd_config~previous
    /etc/syslog.conf~previous

    Among those NOT saved:
    newsyslog.conf

  8. Peter Birk

    The httpd.conf.pre-update was the same as the new httpd.conf for me, but my old version was under the httpd.conf~previous. I copied that and restarted apache and everything is peachy again. Thanks for the tip!

  9. Hans Magnus Nedreberg

    Thank you for this, saved my day!

    I had both the 403 error on localhost, and could not connect to my Zend framework as my path to DOCUMENT_ROOT was compromised.

    I compared the mavericks config file to the backed up one, and a couple of differences:

    Working file:
    # with “/”, the value of ServerRoot is prepended — so “log/foo_log”
    # with ServerRoot set to “/usr” will be interpreted by the
    # server as “/usr/log/foo_log”.

    Mavericks file:
    # with “/”, the value of ServerRoot is prepended — so ‘log/access_log’
    # with ServerRoot set to ‘/www’ will be interpreted by the
    # server as ‘/www/log/access_log’, where as ‘/log/access_log’ will be
    # interpreted as ‘/log/access_log’.

    Working file, line 118:
    #LoadModule php5_module /usr/local/php5/libphp5.so

    Mavericks file, line 119:
    LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so

    Working file, line 218:
    AllowOverride None

    Mavericks file, line 217:
    AllowOverride all

    Working file, line 478:
    # Virtual hosts
    #Include /private/etc/apache2/extra/httpd-vhosts.conf

    Mavericks file, line 477:
    # Virtual hosts
    Include /private/etc/apache2/extra/httpd-vhosts.conf

    Could you explain what they do exactly, and why the Mavericks one causes errors (if you have time)?

    Thanks again!

  10. marwan

    hello i cant seem to find that file :(
    /etc/apache2/httpd.conf.pre-update: No such file or directory
    any idea on how to fix this issue?

    many thanks

  11. miro

    If you need xip.io support simply add “ServerAlias *.xip.io” to the apache vhost config :)

  12. kim

    Thanks Dennis, but I think you missed:

    Additional files preserved by Marvicks install:
    /etc/sudoers~orig

  13. Tiago Magalhães

    Just wanted to add that Xcode is no longer needed to instal Command Line tools apparently… because the option isn’t there.

    Just open Terminal and type “xcode-select –install” and install the tools

  14. Pepa

    I cant connect sites when I am offline. I can reach home.dev but not any particular sites. Can anybody help?

  15. Diogo

    Thanks!! Tried a lot of stuff and nothing worked, but this did the trick!

Leave a Reply

  • (will not be published)

The Perfect Web Development Environment for Your New Mac

I’ve been using this particular configuration for several years, but when I picked up a new laptop recently, I decided to start from scratch. There were a ton of settings, scripts, and programs installed on my old machine that I no longer used, and I wanted them gone. Feel free to use this guide on… Read more »

Don’t Let’s be Pushy

Reclaim your phone's battery (and your) life.

I got the new iPhone 5 as soon as it came out, rewarding myself for resisting the urge to upgrade my 3GS with a cracked screen. My 3GS was 3 years old, and the battery was in a steady decline, and even though I’d be getting a significant technological upgrade, I was most looking forward… Read more »

You’re not the Customer

But For a Small Fee, You Can Be

The internet exploded in the last couple of days when the social square-photo sharing service Instagram released new terms of use. Apparently calling them “terms of service” would not be far too mainstream. The terms include the following paragraph: Some or all of the Service may be supported by advertising revenue. To help us deliver… Read more »

IMG_1028.jpg

Chip

On the Accessibility of Small Mammals

We recently returned from a family trip to Disneyland in California. The “Happiest Place on Earth” did not disappoint. My son is deaf, and also has a visual impairment, but within the boundaries of Disneyland he can be a regular kid. Disney does a tremendous amount to ensure all aspects of the park are not… Read more »

If This Then That

A Wonderfully Simple New Service With Endless Potential

It’s a personal assistant for online services, available to act at a moment’s notice to things that happen in your sleep, or when you have better things to do. “If This Then That”, or ifttt.com, is a service that has been around for over a year now, and I’ve used it for several projects in the last few months.

ColdFusion’s Last Stand

Should Developers Hang On?

For thousands of developers, ColdFusion still pays the bills, and likely will for some time to come, if judging only by the growth in the markets where it is most prominent. Adobe says that CF is thriving with a community of more than half a million developers, but how many of those developers are thriving with ColdFusion?