Tomomi Imura

Tomomi Imura

An Open Web advocate and front-end engineer, who loves everything mobile, and writes about HTML5, CSS, JS, UX, tech events, gadgets, etc. She unintentionally got 15min of fame by creating The HTTP Status Cats. Also, the opinions expressed here are solely her own and do not express the views or opinions of my employer.

Twitter LinkedIn Github Flickr

Creative Commons License
My articles are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

How to Enable WP8 Emulator on Mac

It appears to be that many Mac users, including myself, has had some trouble setting up Windows Phone SDK and run an WP emulator. I once gave up, but after spending some time searching and asking my coworkers around, I finally make Windows Phone 8 emulator runnable on my MacBook Pro, so before I totally forget how I did, I decide to blog and share it with you. (Notes: I am still on OS 10.7.5, on 2.4 GHz Intel Core MacBook Pro, with 8GB memory. and VMWare Fusion 4.1.4, not the latest.)

Install VMWare

First of all, Windows Phone 8 SDK is not available for Mac, so you need to create a virtual machine and install Windows 8 on your Mac. My choice is VMWare Fusion for Mac. Download and install it to get started.

Download Windows 8

You need to download Windows 8 64 bits ISO. You should be able to download the 90 days evaluation for developers from Microsoft MSDN.

Create a virtual machine

Launch VMWare Fusion, and go to menu, File > New. You should see a new dialog:

<img src=”/assets/images/wp-content/uploads/2013/01/iso-icon.png” alt=”” title=”iso-icon” width=”134” height=”124” align=”left” size-full style=”margin-right:1em” wp-image-638” />Go back to Finder, where you have downloaded Windows 8 iso, grab the iso icon and drag it into the dialog.

Then click Continue.

Leave them as-is, and click Continue.

Click Customize Settings before finishing.

Name the virtual machine. e.g. “Windows 8″, and click Save. You should see the Setting dialog now.

First, let’s click the Processors & Memory.

Confugure the CPU by choosing 2 Processor Cores from the first pull-down menu.
Then increase memory. I chose 4096MB.

Note: If you’re on VMWare Fusion 5, select Preferred virtualization engine: Intel VT-x with EPT option at the Advanced setting below the memory setting, and skip the next step. See this article on MSDN.
If you’re on VMWare Fusion 4.x like I do, follow the next step.

Click Show All from top left to go back to the Setting menu, then click Advanced.

For Preferred Virtualization Engine, choose Intel VT-x with EPT.
Close the Settings.

Configure VM

Now, before launching Windows 8, you need to tweak some Virtual Machine configuration.
Exit VMWare.

Then find your virtual machine, probably under yourname/Documents/Virtual Machines/. It may or may not has the .vmwarevm extension depending on your Mac setting.
Ctrl-click and select Show Package Contents.

Now you should find a .vmx file.

Open the file with a text editor of your choice.
Then add these lines:

hypervisor.cpuid.v0 = "FALSE"
mce.enable = "TRUE"
vhv.enable = "TRUE"

Save it, then run the virtual machine.

Launch Windows 8

Now, you are going to need to set up your Windows 8. Go ahead and finish them all.

Install Windows Phone SDK

Once you’re done with the initial setups, open Internet Explorer and go to Microsoft Download Center, then download and install Windows Phone SDK 8.0 on your Windows 8.

Notes: if you are ever asked to press Ctrl-Alt-Delete on Windows on VMWare, and if you’re on MBP like I am, press Fn-Ctrl-Option-Delete combo.

Use Visual Studio Express

<img src=”/assets/images/wp-content/uploads/2013/01/vm13.png” alt=”” title=”vm13” width=”113” height=”113” align=”left” size-full style=”margin-right:1em” wp-image-663” /> Now you should have Visual Studio Express 2012 for Windows Phone installed, so launch it!

Now go to FILE > New Project…
Once you get the dialog, pick a project type. If you are reading my blog, you are very likely to be a web developer, so pick Windows Phone HTML5 App may be good! (but it does not really matter for now, because the ultimate purpose here is launching an emulator!)


You get a bunch of stuff here – XAML template, visual editor etc, etc.

Launch emulator from Visual Studio Express

Click the emulator button.

It should launch an WP emulator! Ta-da!

Unfortunate things can happen. If you get this error message and fail to launch the emulator,

You probably did not configure the .vmx file correctly. Go to the top menu, Virtual Machine > Shut down (not Suspend) and shut down the VM completely first then re-edit and save the .vmx file. Re launch the VM and try again.

Launch the emulator as stand-alone

OK, cool, but as a Mac-using web developer, you may not want to use Visual Studio as an IDE. But the WP8 emulator seems only running within Visual Studio. Do you need to open a dummy project all the time?

No, you can hack it so the emulator can run as a stand-alone.

Go to Desktop, and Ctrl-click. Then New > Shortcut.

To create a shortcut for WVGA/512MB RAM emulator, copy this and paste it into the field:

"C:\Program Files (x86)\Microsoft XDE\8.0\XDE.exe" -createDiffDisk "%LOCALAPPDATA%\Microsoft\XDE\dd.480x800.512.vhd" -vhd "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images\Flash.480x800.vhd"

(All in one line, with the double-quotes).

Then click Next. Name the shortcut. Then Finish.
Now you should have the shortcut icon on desktop.
Double-click to launch the WP8 emulator!

For other emulators:

WVGA

"C:\Program Files (x86)\Microsoft XDE\8.0\XDE.exe" -memsize 1024 -createDiffDisk "%LOCALAPPDATA%\Microsoft\XDE\dd.480x800.1024.vhd" -vhd "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images\Flash.480x800.vhd"

WXGA

"C:\Program Files (x86)\Microsoft XDE\8.0\XDE.exe" -memsize 1024 -createDiffDisk "%LOCALAPPDATA%\Microsoft\XDE\dd.768x1280.1024.vhd" -vhd "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images\Flash.768x1280.vhd"

720P

"C:\Program Files (x86)\Microsoft XDE\8.0\XDE.exe" -memsize 1024 -createDiffDisk "%LOCALAPPDATA%\Microsoft\XDE\dd.720x1280.1024.vhd" -vhd "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images\Flash.720x1280.vhd"

References

Nokia Developer Wiki:
Windows Phone 8 SDK on a Virtual Machine with Working Emulator

NSDN Blog:
How to develop for Windows Phone 8 on your Mac

WP8 のエミュレーターを単体起動するためのショートカット



comments powered by