Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Accessing macOS localhost from Parallels Desktop IE or Edge

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically 10.211.55.2.

  4. You can use this IP address from IE or Edge in Parallels Desktop. Don't forget the port number and protocol, e.g. http://10.211.55.2:3000

  5. It's annoying to remember this IP all the time, so you can edit C:\Windows\System32\drivers\etc (search for Notepad app and right-click to Run as Administrator, then search for this file from within Notepad so that you can actually edit it) and give that IP address a name, e.g. localhost.mac

@bitmanic

This comment has been minimized.

Copy link

bitmanic commented Mar 7, 2018

This just saved my life. For those using Rails, here's how to set the IP: rails s -b 0.0.0.0.

@francoisrenier

This comment has been minimized.

Copy link

francoisrenier commented Mar 27, 2018

Same thing ! You saved my day, thanks for that !
For Angular users, it won't work using ng client by default !
You have to launch your ng serve with the following parameters : ng serve --host=0.0.0.0 --port 4200
So basically adding the --host=0.0.0.0 parameter fixed everything on my side.

You can find the detailed explanation here

@aberikashvili

This comment has been minimized.

Copy link

aberikashvili commented Jul 3, 2018

I'm serving angular 2 app (on macos) with command ng serve --host 0.0.0.0,
then I'm reffering from IE 11 (parallels) to url http://10.211.55.2:4200 and everything works fine.

but I want to modify hosts file and map localhost to 10.211.55.2, so I'm adding line to hosts file:
10.211.55.2 localhost
and when I try to access localhost:4200 from IE 11 it fails to connect

any idea?

@JianglunPro

This comment has been minimized.

Copy link

JianglunPro commented Sep 21, 2018

Thanks bro.

@aaronraimist

This comment has been minimized.

Copy link

aaronraimist commented Oct 25, 2018

Any idea what I need to do if there is no vnic0?

ifconfig: interface vnic0 does not exist

@joshcoast

This comment has been minimized.

Copy link

joshcoast commented Nov 2, 2018

Anyone know how to do this with PHP? I get my local server running like so "php -S localhost:8000"

@kyoheiyazawa

This comment has been minimized.

Copy link

kyoheiyazawa commented Nov 13, 2018

Thanks for this, this really helped me out.

@joshcoast according to http://php.net/manual/en/features.commandline.webserver.php you can do something like php -S 0.0.0.0:8000, haven't tried it myself.

@HarunD

This comment has been minimized.

Copy link

HarunD commented Jan 14, 2019

Thanks for this!

@fwh1990

This comment has been minimized.

Copy link

fwh1990 commented Jan 16, 2019

Save my life. Thanks.

@gongevangen

This comment has been minimized.

Copy link

gongevangen commented Feb 14, 2019

Thanks. It works fine except when I try to define localhost.mac. You don't write which file to edit, but I assume it is host? I tried to define localhost.mac to the IP that works, but I get 'Invalid Host header'

@devinrhode2

This comment has been minimized.

Copy link

devinrhode2 commented Aug 30, 2019

Try "localmac" instead of localhost.mac. Working well for me. Binding to localhost did not work. Simply chaning to localmac fixed it.

@vientang

This comment has been minimized.

Copy link

vientang commented Sep 12, 2019

Thanks for sharing, works like a charm

@piskernik

This comment has been minimized.

Copy link

piskernik commented Mar 26, 2020

I was not able to connect to http://10.211.55.2:3000. I had to connect to the secure site with https://10.211.55.2:3000. Of I had to accept the certificate error as well.

@shahrozeshaikh

This comment has been minimized.

Copy link

shahrozeshaikh commented Apr 7, 2020

This finally made it work. Spent nearly two hours on this. And then realized I had to connect with https like the above comment.

Thank you sir.

@alex-arriaga

This comment has been minimized.

Copy link

alex-arriaga commented May 3, 2020

If using Laravel + artisan

php artisan serve --host=0.0.0.0

# See other options with
php artisan serve --help

And then just visit http://10.211.55.2:8000/ in your VM's Internet Explorer.

@Vetalb8

This comment has been minimized.

Copy link

Vetalb8 commented May 8, 2020

thanks very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.