Developing for Windows on Mac OS X

This past week I setup a new development environment on my MacBook Pro. As I got into it, I realized that it might be a good idea to share the setup process with others who might be switching to a Mac. Unlike a lot of people that use Windows XP for development, I do all my .NET development on Windows Server 2003. I have always had a firm belief in developing on your target environment.

For this discussion, I will be using VMware Fusion to run Windows. I’ve always been a fan of VMware, and their Mac OS X version continues to impress. There are many slick features in VMware Fusion, including Unity mode and dual-processor support. I’m going to be installing on my MacBook Pro, which is a 2.4 GHz Core 2 Duo with 4 GB of RAM (using the Santa Rosa platform, for full 64-bit memory support). I’m going to install the 32-bit version of Windows Server 2003 since the tools are all 32-bit applications.

I highly recommend getting your installation disks as ISO files (from MSDN, of course). VMware can mount the disk images directly, and they load a lot faster than using the physical media. For the purpose of this installation, you’ll need the following disk images:

  • Windows 2003 Server R2 with Service Pack 2 (disk 1, 2 is not needed)
  • Visual Studio 2005 Professional
  • Microsoft MSDN Library for Visual Studio 2005 (optional)
  • Microsoft SQL Server 2005 Developer Edition

You’ll also need the following downloads:

Creating the Virtual Machine

To create your virtual machine, start up VMware. On the Virtual Machine Library window, select New. On the New Virtual Machine Assistant, click Continue. For Operating System, choose Microsoft Windows, for version, choose Windows Server 2003 Standard Edition. When choosing a name for your VM, I find it helps to pick something that reflects what development will be done. I have two, one called W2K3x2K5 and one called W2K3x2K8. As you might guess, the first has Visual Studio 2005 and the latter has Visual Studio 2008.

When choosing a disk size, be sure to give yourself enough room for your tools and applications, but don’t go overboard. Before I rebuilt my VMs, none of them were over 14GB in size so I chose a size that would give a little room to grow. Now, you could pick something like 40GB and configure the VM to grow the disk file as space is consumed but I prefer to allocate the entire disk in 2GB chunks at creation to get the best performance. I don’t usually use a lot of local space since all of my source code is kept in a remote Subversion repository.

The next screen is the Windows Easy Install. This is an easy way to get the operating system setup without any user intervention. Just make sure your install disk ISO is ready, and enter your name, password, and Windows key. Check the “Make your home folder accessible to the virtual machine” so that you can easily transfer data from OS X to Windows. I make the folder read only, since I don’t trust Windows to write to my home folder. Once the Finish screen displays, uncheck the Start and Install now option since we want to make some tweaks before the OS install begins. You can go ahead and pick your ISO for the installation.

Once the VM has been created, go back to the Virtual Machine Library, pick your virtual machine, and click Settings. We need to tweak a few things before we let Windows install.

  • Battery – I let the guest see the battery status
  • Display – Uncheck since we are not using XP
  • Memory – I give the VM 1492 MB, but you can adjust to taste.
  • Processors – Two (2) virtual processors should be set for installation.
  • Network – NAT or Bridged are the only real options here. NAT is good when you don’t need other machines to have access to the VM, but use Bridged if you want a direct link to the network. If you use NAT, you can get to your Mac from the VM using the .host name.
  • Sound – I like sound, I enable it.
  • Shared Folders – This should be fine based on how the VM was created.
  • USB – I like to be able to use my flash drive in the VM, so I enable this option.

Once the settings are tweaked, go ahead and fire up the VM. Windows should install without any user intervention and after a short time (the install runs super fast from the ISO) you should have a working Windows Server 2003 installation. Once you have it up and you are logged in, it’s time to run Windows Update to get all the latest patches (there will be a ton of them). Go ahead and let them install, and be sure to get the optional .NET 2.0 and .NET 3.0 packages as well.

Now that we have Windows setup, it’s time to take away all the things we don’t need.

  • Disable automatic updates — we can do that when we need to do it.
  • Disable remote access into the machine (no Remote Desktop or Remote Assistance).
  • My Computer, Properties, Advanced, select Adjust for Best Performance for Memory and CPU.
  • Set virtual memory to a fixed size of 1GB.
  • Advanced Startup and Recovery – Uncheck all reporting and set Debugging Information to none.
  • Disable error reporting and turn off critical error notification

In the control panel, we need to tweak a few things as well:

  • Set your time zone and turn off automatic time synchronization.
  • Turn off the screen saver, set the background to none, and make sure Windows Classic is selected for the theme.

In the registry, this tweak really decreases disk access in your VM:

  • HKLMSystemCurrentControlSetControlFileSystem
    Add a new DWORD named NtfsDisableLastAccessUpdate and set it to 1.

I also disable the following services:

  • Automatic Updates
  • Error Reporting Service
  • Help and Support
  • Windows Time
  • Wireless Configuration

Remove the following files:

  • All the $whatever$ directories in C:Windows except for the $hf_mig$ directory.

Add Operating System Components

  • Use Add/Remove Programs, and select the Add/Remove Windows Components option.
  • Add IIS (including ASP.NET support)
  • Add Message Queueing (if you plan to use it)
  • Remove Enhanced Internet Explorer Security
  • Install any extra fonts you use for development, such a Consolas.

It’s probably a good idea to run Windows Update again after adding these features since they’ve likely been patched.

Back Up Your New VM

Now that we have a nice clean system, I recommend you shut down the VM and make a backup copy. Simple copy the Documents/Virtual Machines/YourVMName to an external drive so you can easily create new VMs without doing the Windows install again. If you do so, I recommend using SysPrep to reseal the operating system so all new SIDs are created. Do not make a backup for the purpose of closing after installing SQL Server 2005 since it goes crazy if you change the machine name after it is installed.

Software Installation

I recommend installing Visual Studio 2005, followed by SQL Server 2005. For Visual Studio, if you aren’t going to do any Smart Device programming, I highly recommend you uncheck all those packages from the installer. I would also choose not to install Visual J# for obvious reasons. Once the install is complete, be sure to run it at least once. Then install SQL Server 2005 (running as Local System when asked). If you don’t care about SQL 2000 support, don’t bother with the compatibility sort orders and just pick Latin from the top. Once both are installed, go ahead and install VS2005 Service Pack 1 and SQL Server 2005 Service Pack 2.

At this point, you have a pretty basic system with the needed applications. If you’re going to do any work on open source projects, you will need Subversion, TortoiseSVN, and NAnt. Many recommend VisualSVN, but I have never used it so I can’t comment but I’ve heard good things. When downloading applications to install, I recommend pulling them down using Safari into your Downloads folder. Then in your VM, go to the “on my Mac” share and run the installers from your shared folder. I never download anything inside the VM unless I absolutely know it can be trusted (which is pretty much never).

You will notice that I didn’t install any “fearware” such as virus or spyware tools. That’s my style, I don’t really care to slow down my system with things of that nature. I maintain a tight VM and rarely introduce anything from the outside so it’s my choice. Your mileage may vary.

And before I write another word, you should install Resharper and start on your path to becoming a Resharper Jedi.

Wrap Up

I hope this post has been helpful for those looking to setup a development VM. I’ve found that using Leopard OS X for everything but development to be a pleasure compared to the applications available for Windows.

About Chris Patterson

Chris is a senior architect for RelayHealth, the connectivity business of the nation's leading healthcare services company. There he is responsible for the architecture and development of applications and services that accelerate care delivery by connecting patients, providers, pharmacies, and financial institutions. Previously, he led the development of a new content delivery platform for TV Guide, enabling the launch of a new entertainment network seen on thousands of cable television systems. In his spare time, Chris is an active open-source developer and a primary contributor to MassTransit, a distributed application framework for .NET. In 2009, he was awarded the Most Valuable Professional award by Microsoft for his technical community contributions.
This entry was posted in .net, mac, osx. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • VMWare has the capability to load your bootcamp partition into a VMWare session. I have found that first installing windows to a bootcamp partition and then loading bootcamp within osx is ALOT faster then installing your windows os to a vmware virtual disk.

    I have tried it both ways and after about 4 wipe and reloads I have confirmed that it is in fact faster. Possibly because you are working with a physical partition rather than a disk image within a partition.

    The only thing that stinks though is that time machine cannot backup your bootcamp partition but it would be easier to just take an image of the partition and back it up that way.

    After using bootcamp with vmware I couldn’t imagine going back the other way. My main development machine is now my MBP with bootcamp+vmware. very cool indeed!

    It helps even more if you then get a bluetooth mighty mouse as it supports right click.

  • Just curious, what’s the advantage of this over something like parallels? I personally like having both cores working for me in my dev env.

  • With VMware Fusion, you get both cores working for you. If I recall, Parallels can only show a single core to the guest operating system.

    As for the benchmarks that you say have a BootCamp running faster than a virtual disk, I recall reading online of an actual measured benchmark showing the virtual disk to be faster when the total size is preallocated compared to using another partition via BootCamp. It had something to do with the file system caching you get with Leopard that runs underneath the virtual disk making it faster than a physical disk. I also recall it somehow having to do some translation between the partition into Fusion.

    The other benefit for me is that I have multiple environments, one with 2005 and one with 2008. You can only have a single BootCamp partition. I like to be able to just copy a folder to an external drive for a backup and then make copies of it so that I can have a clean environment every few months.

    I’m not saying your method is wrong, you’re obviously on the right track. And yes, a Bluetooth mouse makes for a nicer user experience when coding. You know, the Mighty Mouse has left and right click, in addition to the trackball middle-click.

  • Thanks for the post Chris. Now if I can only save up enough pennies to get one of these pieces of art!

  • @Joe,
    Indeed. Maybe a “Help Joe & Joe get a MBP” program is in order…lol. Sure would help me in my current Rails projects… :D

  • Colin Ramsay

    I’d maybe buy a MBP if someone could show me some decent Vista benchmarks for it, but other than that, I’ll pass.

    I’m more interested in how Win2003 is for Visual Studio? I use XP for running it in a VM and that’s fine, though maybe a little bulky…

  • I’ll leave a PC publication to show you that the MacBook pro was the fastest Vista laptop:,136649-page,3-c,notebooks/article.html

    As for using Windows Server 2003, it works a lot better than XP in my opinion. I have no desire for all “features” of XP and having a real IIS stack to test with is much more desirable than the personal web services that you get with XP. I can’t imagine running XP having not run it in nearly a year.