Here’s a simple command that will startup an HTTP server from any given folder on a Mac. Open Terminal, cd to change to the directory you wish to serve files from, and then execute the following command.
python -m SimpleHTTPServer 8000
Python 3.x+ releases
If you’re a Mac Python user who has installed or updated to Python 3, then you’ll find the traditional command string from the prior Python versions does not work to initiate the web server in new Python 3.x+ releases. For Python 3.x+, use the following instead:
python -m http.server
OR (depending on how Python 3.x is installed and named):
python3 -m http.server