I've been using an Ubuntu distro for a few years now and I greatly prefer the default Apache2 settings on Ubuntu compared to OS X. This post aims to provide instructions on how to convert the few settings I want from 'mac-style' to 'ubuntu-style'.

I'm trying to change the default behaviour of Apache on OS X to be similar to Ubuntu, including both the apache user / group and work directory. The information I have found so far on this points to the following:

  • Apache on Ubuntu runs under www-data, on Mac under _www
  • Apache on Ubuntu uses /var/www, on Mac /Library/Webserver/Documents

I got this information on Mac from /etc/apache2/httpd.conf.

My questions:

  1. Do I need to delete the _www user / group, before making the new www-data user and group, or can I simply change the former? How do I do the correct one without breaking everything?

  2. I believe I can simply change the line in httpd.conf to change the root directory for files, and create the /var/www/ folder also. But in order to do this in the right way, I'll need the right permissions, so (1) needs to be done first.

The end goal:

To have a www-data user running Apache (like Ubuntu has) rather than _www, and also have my root directory under /var/www (like Ubuntu has) rather than /Library/Webserver/Documents, and for any PHP extensions via PECL or otherwise not to be affected by this change.

How can I set this up correctly so that "it just works", and won't interfere with anything like extensions / other modifications in the future?

I'm running OS X 10.9.4, Apache/2.2.26.

  • I've asked the SF moderators to look at this. As it's worded, it's a very poor fit for their site. I'll check the ubuntu mods. Please note that it's really perfectly on topic here and I'll put a bounty to help promote it as I'd like to see it answered here. 4 up votes and that bounty as soon as it's possible to even place it should help with visibility.
    – bmike
    Aug 25, 2014 at 16:59
  • Is there a version of apache on ubuntu that works perfectly for you? At worst, you could simple download that version open source (or homebrew) and run it instead of Apple's modified version.
    – bmike
    Aug 25, 2014 at 17:02
  • For the specific examples given, I don't see the point. Those are intended to be customized for different operating systems and environments. As for SF, I don't think this would be on topic there. Aug 25, 2014 at 17:03
  • @bmike Thanks. It's not a version of apache that I'm after, I'm trying to replicate the development environment I love on ubuntu simply with user permissions and the directory.
    – James
    Aug 25, 2014 at 17:23
  • Could you try editing things. the title really steers me to think you want apache when it seems you're looking to replicate ubuntu user environment on OS X. If you describe one thing you want to do in the end, perhaps we can get you to your goal rather than having to suss out all the differences between two OS default users and groups.
    – bmike
    Aug 25, 2014 at 17:24

1 Answer 1


You can always do a clean install, from source, of Apache HTTPD, with whatever settings appeal to you. If you want it to walk, talk, and quack like Ubuntu, choose pathnames, user-ids, and everything else to match as part of the 'configure' process. All you need to do to your stock Apple deployment is turn it off to avoid avoid port conflicts.

You could try to reconfigure the Apple default install to be more Ubuntu-ish, but you risk getting tripped up by some obscure decision made by Apple, up to and including source mods. So I suggest that your best best is to use the source, as its authors intend.

  • Although I like this answer, I was looking for a more definite step-by-step answer - as of right now this won't really help many people visiting the site unlike a complete solution with step by step instructions :-)
    – James
    Jul 9, 2015 at 13:43
  • Sorry. I removed it.
    – bmargulies
    Jul 9, 2015 at 14:16

You must log in to answer this question.

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