How to Run a Windows Machine on Mac

Solazzo Nicola
Sep 6, 2019 · 4 min read

If you are a frontend developer you know how difficult is to test the code on windows especially if you are working on macOS.

There is only 1 solution to do that:

You need to create a virtual machine to run windows on your mac.

I know it can sounds difficult and you can think you need to spend a bunch of time but reading this article you will be able to set up everything 20 minutes maximum.

To do that we need to use Vagrant and VirtualBox and at the end I will like also to show you Ngrok. Let’s see how they work:


VirtualBox is a free and open source software for running virtual machines able to run Windows, Linux, and others.


Vagrant is an open source virtual machine manager, it takes care of installing the ISO image on the virtual machine.
With Vagrant is possible to build the virtual machines that you prefer (Windows, Ubuntu, etc…).


Ngrok exposes local servers behind NAT and firewall to a public Internet through secure tunnels.
It provides a public URLs for exposing your local web server making it available on different devices everywhere.

Let’s start from VirtualBox

At first you need to download VirtualBox from this link:

You should see something like that:

Now click on OS X hosts to download it and once you have installed open VirtualBox, you shouldn’t see any virtual machine because you didn’t create any ISO image.

It’s Vagrant time

Now we need to download Vagrant from the following link:

You should see something like that:

Click on macOS to download it and once you have installed go here and search windows 10

Now you should see this:

Click on the first item and now you should see this page:

click on new and it will give you a command line to create your vagrantfile and to create the ISO image on VirtualBox.

So now open your terminal and run this command:

vagrant init senglin/win-10-enterprise-vs2015community \
--box-version 1.0.0

This command will create your Vagrantfile, the main functionality of the Vagrantfile is to describe the type of machine that you want to create (in our case windows 10).

Once you have it run:

vagrant up

This command will create your windows machine on VirtualBox based on the Vagrantfile, this command could take some time(10–15 mins) to be completed.

Now let’s run also

vagrant ssh

This command will drop you into a full-fledged SSH session, Now you can go ahead and interact with the machine and do whatever you want.

If you open VirtualBox you can see your windows machine like that

click on it and will open your windows machine, as password just type vagrant and voilà

But what if you want to show to somebody what we developed and we are running it on our localhost? Here Ngrok comes to help.

Last step: NGROK

Now let’s download NGROK from this url once you have done, unzip it and you will have a file exec, move it in your applications folder.

Now open a new window of the terminal and run:

cd /usr/local/bin

now let’s bring our ngrok file from the applications folder to the bin folder. Why that? Because we would be able to use ngrok from everywhere in our pc. So let’s run:

ln -s /Applications/ngrok ngrok

Now the cool thing happens, because we will create a public URL that you are able to navigate everywhere!

If you are listening your project locally on http://localhost:3000 (for example) with ngrok we will transform the localhost in public URL.

To do that run:

ngrok http -host-header = http://localhost:3000

and you should see something like that:

This is the URL generated and here you go!

Solazzo Nicola

Written by

Full-stack developer Javascript for


This publication includes original articles and tips about frontend technologies.

More From Medium

More from NotOnlyCSS

More from NotOnlyCSS

Turn Your Website into a PWA

More from NotOnlyCSS

More from NotOnlyCSS

How to Remove Unused CSS

More from NotOnlyCSS

More from NotOnlyCSS

11 Vue.js Lifecycle Hooks

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade