The good news is you only need one tiny command to start a web server from any directory through OS X’s terminal as Python comes built in to every Mac.
First, navigate to the directory you want to use - type cd and then drag the folder into your terminal window like so:
Next, enter the following command:
$ python -m SimpleHTTPServer
Afterwards, I can access the following URL in my browser: http://localhost:8000/
Alternative options: Anvil & MAMP
If you don’t need PHP or MySQL, check out Anvil, a beautiful menubar app for managing local websites allowing you to serve up static sites with simple URLs and zero configuration.
For Apache / MySQL / PHP, MAMP works a treat. It comes free of charge, and you can easily install a local server environment in a matter of seconds.
My favourite: Browsersync
My favourite setup has to be Browsersync though. It’s totally free and makes your tweaking and testing faster by synchronising file changes and interactions across multiple devices. You can also easily integrate it with task runners like Grunt and Gulp if you want to.
By connecting any number of devices & browsers a BrowserSync created URL can:
- test responsive designs and see your site rendered on different devices at the same time
- scroll on one browser and other browsers follow the scroll to the same point
- click links and other browsers load the clicked URL
- complete/submit forms and other browsers submit
- change HTML, CSS & JS and automatically inject those new files without a page refresh