I am using a MacBook with OS X Mounain Lion 10.8.3 and I want to install a local web server on my machine. What are my options? On windows I used XAMPP.

  • I wouldn't install anything, but just turn it on... Here is a duplicate question with a decent answer.
    – beroe
    Oct 5, 2013 at 5:33

4 Answers 4


Most of the stuff you need is already installed by default, or can be added easily. There is a lot of material on the web about how to do this, this article seems to cover the basics.


If you just want something very quick, the OSXDaily article Create an Instant Web Server via Terminal Command Line explains how to do this on the command line using Python. Its pretty much just using the command:

python -m SimpleHTTPServer
  • In Python3, that would be python3 -m http.server. Dec 29, 2021 at 2:40
  • Also note that the server will run on port 8000 by default, as ports below 1024 require superuser privileges. Dec 29, 2021 at 2:41

If you are interested in running Apache, PHP, MySQL and phpMyAdmin, you can check out this article.

Or just use MAMP

  • Of the two which is the best?
    – andy
    Oct 3, 2013 at 12:50
  • 1
    We don't know what "best" means for you. If you have specific requirements please add them to your question by editing it.
    – nohillside
    Oct 3, 2013 at 13:23

As already mentioned, there is a simple XAMPP like solution called MAMP which comes as both a free and a paid version. The free version will suit most people. Just like XAMPP this will provide you with Apache, PHP and MySQL, and also PhpMyAdmin/

If you just want to serve a simple html page, with no underlying PHP or anything you could use Python's SimpleHTTPServer, with the following bash function that you can put in your ~/.bash_profile:

function servedir {
    local port="${1:-80}"
    open "http://localhost:${port}/"
    sudo python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"

With the servedir bash function, you simple change to the directory you want to serve, type servedir and then it will open your web browser at http://localhost so you can see your page.

You must log in to answer this question.

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