No one likes testing websites, though testing locally is a great way to make it a little less painful. I mentioned iPhone, iPad and Android though this works for any device on your local network.

Testing Static Websites

Fire up Terminal (Applications > Utilities > Terminal) and cd to the root directory of your website. A quick way is to just drag and drop a Finder window into the Terminal window.

Hit return and you’ll now be within your website root. Then type python -m SimpleHTTPServer and hit return. It will say something along the lines of Serving HTTP on 0.0.0.0 port 8000…

Now go to your Network settings (Applications > System Preferences > Network) and under Wi-Fi grab the IP address. Type that into your devices browser, followed by a colon, then the port number. In my case I type in 10.0.1.4:8000.

To finish the session close the Terminal window and it will ask for confirmation that you want to stop the process.

Testing Dynamic Websites

If your wanting to test a dynamic website—such as a WordPress website—the process is slightly different.

If you’re developing a dynamic website locally you should already have MAMP or similar installed. If not download it from the MAMP Website. I’m using MAMP Pro but the process is essentially the same for all versions.

Go to Network settings (Applications > System Preferences > Network) and under Wi-Fi grab the IP address. Next in MAMP grab the Apache Port (I believe this is under MAMP > Preferences in the non pro version)

Type the IP into your device browser followed by a colon then the port number. In my case I type in 10.0.1.4:80.

Note: If you use virtual hosts like me, you'll have to use localhost and change the disk location to the site root. (Annoyingly that means it needs to be updated for each website—if you have a work around hit me up on Twitter.)