Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I move the Library/WebServer/Documents folder, which contains files shown by http://localhost ? For instance, to the Desktop. Also, can the ~/Sites folder be moved too?

share|improve this question
Wouldn't it be easier to change the web root for apache to point to your location rather than change system files? – bmike Jul 6 '11 at 21:54
up vote 4 down vote accepted

So the short answer with reply is, "Sure, but WHY?!?"

The WebServer for Mac OS X (I'm assuming 10.6 Snow Leopard Client for the details of the answer) is based entirely on Apache. There are tonnes of web resources for Apache.

The key to Apple's Web Services are in /etc/apache2

You can (with admin privs) modify the httpd.conf (again; loads of web refs on this file) specifically pointing DocumentRoot anywhere.

However; and this is the list of caveats of why this is a weird thing to do...

  • You have to be sure that the web process has the proper privs to read the directory in the location you may move it.
  • You run the risk of something getting access to other files around the moved location
  • This is non-standard configuration in the OS and is likely to break in a future verison
  • The location is non-user volatile; meaning that deleting a user won't accidentally delete the served root folder. (Apache will fail to launch) if it can't find a served root folder

On top of this; we talk about moving the ~Sites. When you generate a new user acct; the OS generates a virtual directory conf in the /etc/apache2/users directory. Apache is smart enough to expand the ~ into a user name. All the above Caveats hold.

The question is why do you want the root folder on your desktop? It would seem to be more convenient to do one or more of the following:

  • make an alias of /Library/WebServer/Documents on your desktop
  • Setup groups/acls on /Library/WebServer/Documents to assure the correct write access

Without knowing why you're motivated to do this; I can't really hazard any other suggestions.

If it's a question of moving your web services directory to a network share... Now your solution is more along the lines of OS X Server (10.6) or doing your own apache install.

Good luck.

You have to be sure that the web process has the proper privs to read the directory in the location you may move it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.