Start A Simple Web Server From Any Directory On Your Mac

Mac: You need only one tiny command to start a web server from any directory through OS X's terminal. If you've got a website lying around and need to test it out, this is possibly the fastest way to make that happen.

Just navigate to the directory you want to use and enter the following command:

python -m SimpleHTTPServer 8000

You may want to change the port if you already have something running on 8000, but the command otherwise doesn't require much alteration. It's a great little snippet to keep in mind (or in your TextExpander shortcuts) for the next time you need a quick little web server.

What are some tips or tricks for Terminal in Mac OS X? [StackExchange]


Comments

    And to stop it?

      Control C

    Just stop the python process it creates, for example with Activity Monitor

    Regards,
    David

    this is so many types of awesome. thanks!

Join the discussion!