Run a webserver in any folder on Mac OS X

TL;DR;

How to host static files from commandline on Mac OS X using Python.

Problem:

Hosting HTML files in a proper webserver on Mac OS X without having to install something like Apache HTTPD or nginx and configure. I want the simplest solution to get this up and running.

Solution:

Run the following snippet and you’ll have a working HTTP server hosting your static content on port 8000.

cd /path/to/my/folder
python -m SimpleHTTPServer 8000

Credit goes to Lifehacker.