Testing macOS localhost from Windows VM in Virtualbox- 1 min
When developing any website, it is essential to test your changes on old versions of Internet Explorer. IE ships out of the box on Windows and Microsoft sold well over a billion copies of Windows. There are plenty of tools that promise to take the hassles of running virtual machines locally, but older versions of IE had a horrible debugger, and it is quite painful and slow to debug website over a video stream.
Share Mac Localhost with Windows VM
In my example, I use Virtualbox, but the step should work the same way in any other virtualization software.
In VirtualBox settings, check if the network adapter is set to NAT.
Note your gateway IP on your Windows VM. You can do this by opening in command prompt and typing
By default, Windows does not permit users to modify system files. Open
C:\Windows\System32\drivers\etc folder and change the permission of
hosts file such that your user has access to write that file.
C:\Windows\System32\drivers\etc\hosts file in Notepad and add your gateway IP address at the end of the file.
You should now be able to access your Mac’s localhost on your Internet Explorer virtual machine. Happy debugging!
These VMs stop working after 90 days, but you can efficiently work around it, by taking a snapshot after first importing the VM. ↩