Working with this whole IIS / Windows thing in OS X
First though, here is the development situation I need to work with.
- Windows 7
- IIS 7
- Visual Studio for occasional building
- MSSQL for hooking up a database
- SVN for version control
All of the websites I develop for are either using Umbraco, Sitefinity, or are some type of an MVC application. I’ve found I only need to be in Windows for a couple of specific things: Moving a database around in MSSQL Server and rebuilding a project in Visual Studio. For convenience, I also push and pull changes to SVN in Windows, but I could always pull up the terminal in OS X.
For everything else, I happily live in OS X
- HTML / CSS
- Compass / Sass compiling
- Browsing the localhost
The first step: VMware Fusion running Windows 7
First, there is no way to run IIS in OS X. It needs Windows, so running some kind of virtual machine is inescapable. I’m running a 32-bit Windows 7 in VMware Fusion. To help with system resources, most of the Windows bling is turned off (the shininess, the animated desktop effects, etc).
Goal #1: Browse local IIS sites in OS X
Find the Windows virtual machine IP address
To actually browse sites served by the Windows virtual machine’s IIS, you’ll need to lookup the IP address assigned to the Windows network adapter. One common way to find it is by running ipconfig in the command prompt, but if you’re IP is assigned dynamically like mine, looking this number up can get real old after a while. A handy tool to help with that is Bginfo. Today my IP is 192.168.118.130.
The VM’s Network Adapter – Bridged / NAT / Host-only
Depending on your router situation, you may need to give special attention to the Network Adapter found in VMware Fusion > Virtual Machine > Network Adapter.
Bridged is the default and should work in most cases.
If your router only assigns 1 IP per device, which may be typical of some enterprise setups, you may need to change this to Host-only and create a separate NAT network adapter.
Assign a port to each IIS site
For each project in Windows, I create a site in the IIS manager with the physical path as the project’s directory in Windows. So I can browse the site in OS X, I’ll assign a port a unique number. Usually I’ll follow a pattern that’s easy to remember – 8080, 8181, 8282, etc. This can be all be done by Right clicking > Add new site in the IIS Manager’s connections pane.
Browse to the IIS site in OS X
After creating the website in IIS and assigning a port number to it, everything should be good to go. In OS X, my IIS website will now pull up by going to http://192.168.118.130:8080.
Goal #2: Browse and edit the project files on Mac
There wouldn’t be much of a use for doing all of this if you couldn’t actually edit the code on the other side. Connecting to a Mac folder in Windows (a network drive) works but IIS does not detect file changes as they are made. The best way I’ve found to do this is to keep everything in Windows and share to the Mac side.
Share the project directory in Windows
First, navigate to the physical path of your web project and share it using the typical Windows sharing methods. Right click > Properties > Sharing. This could be simple or complicated depending on your network setup.
Find the Windows 7 host name
Bginfo displays this on my desktop, but it can also be found by going to Start > Computer > Properties and looking at computer name. My VM’s host name is N_KEMCHVM. This is the host I will connect to via the SMB (Samba) in OS X.
Connect to the shared directory in OS X
Finally, connect to the shared directory with Go > Connect to Server in OS X. The server address for me would be smb://N_KEMCHVM. Log in with the user name and password that the directory is shared with.
The project directory is now fully capable in OS X. Essentially, I am able to do most all development in OS X.
The daily routine
My routine for starting the web dev day now goes something like this:
- Fire up VMware
- Identify my VM’s IP
- Browse to the local development site
- Connect to the VM’s file directory via SMB
- Hide VMware and work in OS X
- Apr 08, 2013 – Takeaways from An Event Apart 2013
- Feb 26, 2013 – Working with this whole IIS / Windows thing in OS X
- Feb 03, 2013 – Buttons and color chips with SASS color functions
- Jan 21, 2013 – Designing in the Browser – Working with Color