Viewing VMware Fusion guest Cassini/Development Server on host

April 25th, 2010 § 3 comments § permalink


Using a Mac is great. You can pry mine from my cold, dead hands. However, there are times I need to run things in a Windows VM. It’s easiest to do as much work as possible in VM but there’s the unavoidable need to connect remote machines to the guest server.

In my specific case I am part of a team developing a C# app so that means Visual Studio 2008 and its built-in development server, Cassini. Microsoft added this lovely hard-coded trick to Cassini so that it listens only to requests from the loopback, localhost. This is supposedly to prevent developers from shipping apps with Cassini built in. I don’t care about the reason. I care that I can’t connect to my development VM on my Mac or any other remote machine. There is a fairly simple solution to that, though.

My setup

  • OS X 10.6.3
  • VMware Fusion 3.0.2
    • Windows 7 Professional
    • Visual Studio 2008
    • VPN’d connection to the office

Yes, it’s wonky to VPN in my VM but I can’t VPN in my Mac and that’s a whole other story.

What you’ll need

That’s it.

The Concept

Fiddler is a debugging proxy but it also has the ability to be a reverse proxy. We’re going to use that feature to take requests to the guest VM on Fiddler’s port of 8888 and automatically reroute them to Cassini’s port.

The Execution

First thing’s first: my particular setup is probably unique and the tedious steps I’m about to list will likely never be needed by the average developer. However, if I need them that tells me someone else does as well so this is bound to help some lucky Googler.

  1. Make sure your VM’s network connection is running in Bridged mode
  2. Start your Cassini server by going to Visual Studio in your guest VM and pressing ctrl+F5
  3. Fire up Fiddler and open Tools->Options
  4. In the Connections tab make sure “Allow remote computers to connect” is checked and hit OK to close the options window
  5. Press ctrl+r to open the rules (defaults to opening it in notepad.exe)
  6. Search for the OnBeforeRequest function and add the following condition:

    if ( == "") = "localhost:5867";

    Just modify the IP to be your VM’s IP and change 5867 to be Cassini’s port

  7. Fire up cmd.exe and renew your IP by doing an ipconfig/release followed by ipconfig/renew

You’re done!

Testing your work

Now that Fiddler is set up to route requests to Cassini you can go to any machine on your local network, type in your VM’s IP followed by Fiddler’s port and Fiddler will accept your request, route it to Cassini and return back results. In case you need to copy and paste something the path in my browser is simply

Ways to improve this

There’s an additional rule that can be added to Fiddler. In the OnBeforeResponse add the condition “oSession.utilReplaceInResponse("localhost:5867","");“. That does what it sounds like. You may have noted the magic numbers in the Fiddler rules. These will suck to maintain. You can right-click your web solution, go to properties, click the Web tab and assign a specific port. If you go to your Windows network settings and force in an IP you’ll never have to edit the rules file again. However, these are hack solutions around a weak implementation.

A potentially better route would be to ditch Cassini altogether and use UltiDev, a free .NET server. I may still. Should get around these headaches fairly well.

The best option would be to run IIS in your VM. For an as-yet-undiagnosed reason my web solution will not allow me to run it through IIS. I hope you, casual reader, have more luck.


There have to be more devs out there running a Windows VM in their Mac, needing to test their web apps in OS X, on their iPod Touch/iPhone/iPad, Blackberry, yada yada. Yes, this could all be solved by using the dev or QA server but those aren’t updated automatically and I can’t be bothered to make a build every time I want to tweak some JavaScript. I’m marking this down as an exercise in learning about VM networking types, reverse proxy functionality and the power of releasing and renewing your DHCP license.

PHP and Segmentation Fault (11)

November 16th, 2009 § Comments Off on PHP and Segmentation Fault (11) § permalink

Despite research that feels all-inclusive, reading other blogger’s posts and the collective groans on Marc’s message board (not to mention my own now-invalid feeling of accomplishment) I am still being bested by the infamous “child pid xxxxx exit signal Segmentation fault (11)” issue.

From what I can tell the segmentation fault occurs when I execute odbc_fetch_array. I cannot tell you what a joy it is to try and debug a script that dies when using a built-in function. PHP 5.3 how I wanted to love you. How I so very much despise you now.

If anybody out there in the tubes has any helpful, constructive ideas I sure would appreciate some feedback in the comments.

Compiling Subversion 1.6 on a Mac

October 12th, 2009 § Comments Off on Compiling Subversion 1.6 on a Mac § permalink

If it wasn’t already obvious from my previous posts I’ve been bitten by the dangerous and anti-productive bug that is building your own apps from source. However, with the case of Subversion I feel the need to build this one instead of using the installer as I prefer my local apps to go in to /usr/local not into /opt.

Word of warning: My personal needs for SVN do not include the Berkeley DB, Neon or other more advanced features. If you require those features, you can run ./configure --help to review the possible arguments and what is required to use them.

  1. Download the latest Subversion source. I chose 1.6.5.
  2. Decompress the package. You can click on the tarball or use Terminal to run this: tar xvjf subversion-1.6.5.tar.bz2
  3. Now run the following commands in terminal:
    cd subversion-1.6.5
    ./configure --prefix=/usr/local --with-ssl --with-zlib=/usr/lib
    sudo make install

That’s it! You’re done and can test your version by running the following command in Terminal: svn --version --quiet.

Using Remote Disc on non-MacBook Air machines

September 27th, 2009 § 1 comment § permalink

Just a quick tip on how to use the “Remote Disc” capabilities on any Mac that isn’t an Air. For some reason Apple will let you share a drive but not read it over the network unless you’re on an Air. Yet another quirk from Cupertino. In any case, the solution is easy.

Open up Terminal and run these two commands to update your settings. If you’re afraid of Terminal, just copy and paste these. Trust me, they’re harmless.

defaults write EnableODiskBrowsing -bool true
defaults write ODSSupported -bool true

Then open up Activity Monitor and force quit Finder. It will automatically restart. Open up a Finder window and marvel at the glory of sharing an OS X install disc over the network. Particularly handy when your MacBook Pro won’t read a disc.

I’m off to install Snow Leopard on my home/studio MacBook Pro. Over the wireless. Why does this sound like a bad idea? Hmm….

Making Snow Leopard’s PHP 5.3.0 usable in the real world

September 24th, 2009 § 21 comments § permalink


It has been a while since I originally posted this article and somethings have changed. Marc Liyanage has posted his custom PHP 5.3.0 build and, as noted by a comment from Sam, a simple flag would have helped a lot. So…carry on.

As of writing the standard 5.2.x Entropy package from Marc Liyanage does not work with 10.6. This means either a custom compile of PHP 5.2.x and the required extensions or piggybacking the default 5.3.0 install. After spending a few days attempting trying to modify the existing Entropy install, trying to build new plug-ins against it and many other techniques it became clear that the quickest path back to development was to used the 5.3.0 install and provide the missing plug-ins.

What’s missing with the 5.3.0 install

The default Apple install provides many nice plug-ins but thus far there have been a few critical ones noted as missing which require building on your own machine and installing into your PHP’s extension directory. The process is the same for each of these but will be tackled on a one-by-one basis.

Preparaing your environment to build extensions

Compiling PHP extensions is easy, requiring only the PHP source from Download the PHP source using your browser, cURL or another available method as Snow Leopard lacks wget. Extract the code to a temporary directory, such as ~/source_files/php. Although 10.6 is a 64-bit environment these will be four way builds, just in case Apache, PHP or any other environment calls for 32-bit compiles.

Set up your arguments environment with this command:

CFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64'
LDFLAGS='-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64'
CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64'


Download the latest version of libmcrypt from SourceForge and unpack into ~/source_files/libmcrypt. Execute the build with these commands:

cd ~/source_files/libmcrypt/
./configure --disable-posix-threads --disable-shared
sudo make install

With libmcrypt properly built and installed in the system all that’s left is building the code provided in the PHP source.


cd ~/source_files/php/ext/mhash
sudo make install


cd ~/source_files/php/ext/mcrypt
sudo make install


I have not yet attempted an MSSQL extension compilation but I can already assume you’ll need to download FreeTDS before starting. Anybody who gets this done should do us all a favor and post something in the comments.

See also:

Snow Leopard upgrade = broken development environment

September 2nd, 2009 § 2 comments § permalink

Update: 2009-09-24: Still waiting on an Entropy package for Snow Leopard? You have two choices if you need to get work done and can’t be bothered to wait: Downgrade back to Leopard (OS X 10.5) or start compiling PHP extensions until you have enough to get things done. I’ve created a new post on how to get some basic things working and helpful links to other common issues (segmentation faults anybody?)

Just a quick note to any Mac users who update from Leopard (10.5) to Snow Leopard (10.6) and use Marc Liyanage’s PHP package, entropy: Snow Leopard will hose your custom PHP setup. This isn’t really a fault of 10.6 and I’m not complaining about the upgrade. Actually, all things considered the upgrade was fairly seamless and without hiccup. It’s just that Apple let the installer get a little greedy and overwrite some existing configs.

Snow Leopard’s default PHP install uses 5.3.0 and includes what should be default extensions, such as GD, but does not include others like mcrypt. Our IT department is waiting for at least 5.3.2 to migrate so I still have a need to develop and test on 5.2.x, which means I either need to recompile an older version of PHP or use an existing package. Because this is the 21st century and I have better ways to spend my time I choose to go with an existing package. Unfortunately, OS X still does not have a unified package manager so I can’t just “yum php5.2.9” or something like that.

I’m still in the process of getting my environment working so I’ll list a few of the issues I’ve experienced and update this post as I resolve them.

  • httpd-vhosts.conf is overwritten and you lose your custom vhosts. Oddly, /etc/hosts is left alone.
  • Apache initializes but only serves up white pages. Error logs spit out “[notice] child pid xxxx exit signal Segmentation fault (11)”. No help from the tubes on this one.
  • Trying to lipo out the x86_64 architecture from to force 64-bit mode did not help.
  • Disabling all extensions listed in /usr/local/php5/php.d/ had no effect.

If you have any suggestions or have successfully installed a 5.2.9 entropy package on an upgraded 10.6, please leave a comment so I can get this mamma jamma working. I’ve created a new post describing my steps to get the 10.6 PHP install of 5.3.0 working with some basic extensions. All all comments should be directed toward that post.

All aboard the Windows QuickTime fail boat

September 22nd, 2008 § Comments Off on All aboard the Windows QuickTime fail boat § permalink

(or How I Learned To Loathe Independent Subsystem Settings)

For years I was a Winamp user. Man, I was downright ecstatic to use Winamp. Fast, feature-rich, lightweight…it was a dream. More importantly, it made my music sound great over my 5.1 speaker system. Then I got an iPod as a gift. In those days it was the dark ages of Winamp to iPod synchronization. It was a gamble; you could load more music or wipe the whole thing clean using the same button. And so, with a heavy heart, I made the painful switch to iTunes.

Like anything worth doing, I did it full-bore, diving into iTunes and never looking back to Winamp. As the years went by I kept the same speakers but iTunes grew, turning into the application it is today. Still, during every format I installed the latest copy of Winamp. Call it nostalgia but I just felt the need to have a copy around. Hardly ever used, Winamp was relegated to my defacto mp3 preview app as it started up instantly and was still relatively light on the resources consumed.

Not too long ago I downloaded a sample mp3 for a band (Genesis, by Justice) and by the time the main groove hit I was hooked. Shortly thereafter I had ripped the cd to my drive and tossed it into iTunes. But wait, something strange had happened in the transition from the sample mp3 to the full album. The song sounded flatter, weaker, missing in the upper and lower frequencies. I had followed my normal ripping procedure – EAC with LAME, using my custom configuration –  but I tried it again anyway, blaming folly. Still the same results. Out of curiosity I tried playing the song in Winamp and magically the fullness had returned!

Something was awry with iTunes. Following the tubes I found post after post blaming QuickTime for using wave out instead of DirectSound. However, inspecting my QuickTime settings showed that DirectSound was selected by default. Then, as I hopelessly clicked through the setting tabs, I saw something which defied logical explanation.

QuickTime was configured for a stereo speaker output despite Windows having a 5.1 configuration! Why Apple would choose to allow a secondary source of speaker setting, especially one which countered the Windows setting, was beyond me. With reserved hope I selected “5.1 (L R C LFE Ls Rs)” from the dropdown, stabbed the “Apply” button and waited for the configuration to save.

I tell you, I haven’t heard iTunes sound so sweet until that moment. My library felt alive again, full of verve and detail! Although the audiophile in me was saddened to realize I couldn’t notice a lack in quality all these years, this was quickly replaced with joy by my music’s new lease on life.

Lesson learned: Do not ever rely on third-party applications to obey the rules and settings of the host OS. Always explore all options. Ruthlessly configure and tune. Stock configurations are for people who don’t care. Option panels are for those who want to make their software work for them, not against.