Running Fiddler on Mac OS X

Fiddler is an awesome HTTP debugging proxy server application that can really come in handy for software development.  If you haven’t used it before, you should definitely check it out.  While I’ve normally been running a Windows machine I recently decided to try out using a MacBook Pro, and it wasn’t long before I needed Fiddler.  They have a beta build out that utilizes the Mono framework, but I had a little trouble getting it to run on my Mac.

If you’re installing Mono for the first time, you’ll need to run this command at a command prompt:

/Library/Frameworks/Mono.framework/Versions/current/bin/mozroots --import -- sync

This assumes you have a symlink for your latest version of Mono at /Library/Frameworks/Mono.framework/Versions/current; if not, or if you have Mono installed to a different path, just replace the path to your installation’s bin directory accordingly. The install instructions included with Fiddler for OS X has more on this. For Fiddler, you simply need to extract it to a folder you have write access to. I chose ~/Applications/fiddler-mac. Assuming the Mono bin directory is added to your PATH environment variable, you then just have to run mono Fiddler.exe in Terminal (from the directory you extracted Fiddler to).

Since 64-bit Mono is not fully supported at the time of this posting, you have to force it to run as 32-bit.  Of course, being an avid PowerShell user I’m also running PowerShell on my Mac.  It has its quirks when running on a system other than Windows, but more on that later.  Anyway, although it’s trivial to launch Fiddler when needed I prefer things easy and added this little gem to my PowerShell profile to easily launch it from the command-line:

# again, this assumes your Mono framework is installed at the specified path
# it also assumes you have Fiddler extracted to '~/Applications/fiddler-mac/'
if(-not (Get-Command mono -ea SilentlyContinue)) {
  $env:PATH = $env:PATH.TrimEnd(':') + ':/Library/Frameworks/Mono.framework/Versions/current/bin';
}
function Start-Fiddler {
[CmdletBinding()]
param (
  [Parameter(Position=0, Mandatory=$false)]
  [ValidateNotNullOrEmpty()]
  [string] $fiddlerPath = '~/Applications/fiddler-mac/fiddler.exe'
)

  mono --arch=32 $fiddlerPath
}
Set-Alias fiddler Start-Fiddler -Scope Global

And of course, now all I have to do is type fiddler from my PowerShell prompt to run Fiddler.

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *