Accessing localhost on Mac from Windows VM Virtualbox

Guilherme Sa
1 min readNov 29, 2016

--

During Mac front-end web development — how do I QA my work onMicrosoft IE/Edge browsers?

Microsoft offers Free Virtual Machines from IE8 to MS Edge. You’ll also need Virtualbox.

  1. On Virtualbox, make sure your network adapter is set to NAT. On your Windows VM, your internet connection to google.com should be working.
  2. Get your `gateway IP address` for your Windows VM. To do so, click on the Windows start menu. Type `Command Prompt` in the search field. Open the program and type `ipconfig`.
  3. Again on Windows VM, click on the Windows start menu. Type `Notepad`. Right-click on Notepad and select `Run as administrator`.
  4. From Notepad, open `C:\Windows\System32\drivers\etc\hosts.conf`. Add this line to the bottom: your_gateway_ip localhost. So for example: 10.0.2.2 localhost. Save and that should do it.

If editing hosts.conf does not work, try visiting your gateway IP with appropriate port where your web server is running on your Mac. In my case http://10.0.2.2:9080 is equivalent to http://localhost:9080.

--

--

Guilherme Sa

Front-end developer for Karmic Labs. Helping to build smart debit and credit cards monitored by software.