At the moment I’m working on a responsive web application that requires lots of testing on mobile devices such as iPhones and iPads.

Besides using chrome plug-in called Viewport Resizer that can help previewing our application on lot of different screen sizes, sometimes we need to test is on the actual device.

But how to we do that without having to deploy the application on a public server?

Well, if you are using Vagrant and Mac, there is a quick way to do that.

In your Mac just go to System Preferences –> Sharing as showed bellow:

Select the box File Sharing and give your computer a name. I named mine rod, so it can be accessed by rod.local.

After doing that, you will need to create a virtual host with your computer name in both your Vagrant VM and your local machine and you are done.

On your mobile device just type http://rod.local or, if you use and specific port http://rod.local:8000

I notice that this only work with apple devices. Somehow it doesn’t work with android phones or tablets (why?). I’m still trying to figure that out.

Let me know in the comments if you have a solution for this.

Comments