Start Local HTTP Server in MacOS X with One Simple Command

You can start a local web server to try your web site with one single command. Open Terminal, navigate to the folder that you want to use as a local server and type one of the following commands:
To open with browser typing: http://localhost:8000

python -m SimpleHTTPServer

If you don’t want to write the port you can specify it before.
Then you have to type in browser: http://localhost

sudo python -m SimpleHTTPServer 80

Note: You can specify any port that you need (for example, port 8080).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.