Testing a Mac OS X web site using a local hostname on a mobile device

If you have a locally-hosted version of a web site for testing or development, you’ll almost certainly want to test it on a mobile device.

Let’s say the local site is hosted on Mac OS X, and you access it with a URL containing a hostname defined locally in the Mac’s “hosts” file, such as http://exampledev.com.

How can you test the site using the same URL on a mobile device (that is, a real mobile device, not an emulator)—without jailbreaking the device, using a DNS server, or paying for additional software? In this post I’ll describe a way to do exactly that.

Continue reading