I have been using MAMP PRO¬†for quite some time for Apache, PHP, and MySQL and always found it very easy to use. However, I feel that I am paying uselessly for updates every time when I can do it easily myself. So I decided to completely remove that from my iMac and now the real struggle begins – where and how the default Apache is triggered and where is the path for localhost. After some searches, I found that you can easily find the localhost host folder for Mac OS X using the following command –

httpd -t -D DUMP_INCLUDES

The output should give you the path to Apache’s httpd.config file using which you can open using vi editor or any editor that you like. In this file, you should look for the word “DocumentRoot” as it will contain the path for the folder that Apache is going to serve by default to the browser/public. My Mac OS X’s default path is as following –

DocumentRoot "/Library/WebServer/Documents"

You will also find <Directory> … </Directory> tag in the same file, but that is something to define rules for that particular directory.

I hope this post will help you find the localhost folder on your Mac OS X. If you have any other way to find it, please share in comments.

Stay Digified!!
Sachin Khosla

Share this post: