Accessing macOS localhost from Parallels Windows 10

Quick reference sheet for web development when testing a locally hosted macOS app in IE/Edge via Parallels Windows 10.

1. Inside Parallels, go to Preferences > Network > Shared and make sure Connect Mac to this network is checked.
2. In your Mac Terminal run: open /etc/hosts and add 0.0.0.0 domain.local (you may need to sudo chmod 755 /etc/hosts or whatever to allow editing of hosts)
3. From Mac Terminal run ifconfig and look for value under vnic0 > inet. (typically 10.211.55.2).
4. Inside Parallels Windows, open Notepad using Run as administrator. (Search > Type Notepad > Right Click Notepad > Run as administrator > Yes)
5. From Notepad, File > Open and open System32 > drivers > etc > hosts. (You may need to change the file extension to show all types)
6. Edit the hosts file by adding the value from 3 above (typically 10.211.55.2) and mapping it to localmac. eg: 10.211.55.2 localmac
7. Serve app from Mac and make sure the host is specified to domain.local
8. Inside Parallels IE/Edge, navigate to http://localmac:[port] and see your served app.

Notes:
– For some reason, attempting to remap localhost on Windows doesn’t play well so we will use localmac as a workaround and it’s kinda semantic. The name can be anything you want.

  • Make sure your hostname is domain.local (after mapping hosts) or your host is bound to 0.0.0.0 when serving your app on macOS.

  • Opening app on Mac browsers will remain the same: localhost:8081