News for freelance developers


Browser Testing on other machines with Vagrant

Typically, when I do browser testing I leave the worse till the end, that is I avoid testing on Internet Explorer until I have to. Because I work on a Mac, it's not the simplest thing to startup a Windows box with IE. Sure I could download the VM and set it up through Virtual Box. But those files are usually around 4-8 gigs, and it takes considerable memory to spin one up. Also, I have a few older hanging around which run Windows so it seems like I should just be able to access the sites.

Fortunately, when you are building off a Vagrant machine it's actually quite easy to get setup. Here's all you need to do.

  • If Vagrant is running, run vagrant halt
  • Open up Vagrantfile
  • Comment out the line with ` "private_network" if it exists "private_network", ip:...
  • Add a new line below which exposes the VM to the public network "public_network"
  • Save the file
  • Run vagrant up
  • Pick the correct adaptor to share your the Vagrant site. On a mac I pick the first option which is to share on my local WiFi.
  • Wait until it's done
  • vagrant ssh
  • run ifconfig
  • Take note of the IP address from ifconfig in the eth1 section

From this point your site should be accessible from other computers connected to your network by entering the IP address!

Now you can open up your site on other machines!

Make the leap.
Subscribe to the newsletter
and learn how to become a freelance developer.