journal of recreational computer science

home

Running SDRSharp on Mac OS X

22 Feb 2014

Important note: This approach may not work for modern SDRSharp releases. Click here for details.

A while back I bought one of those 15 GBP DVB-T dongles to see if they’re good for anything. Turns out, they’re pretty amazing devices, and you can’t possibly beat the price given its capabilities.

20140222-dongle.jpg

Sadly, the variety of software available for the Mac leaves much to be desired. Apart from the rtlsdr suite and Gqrx, there are very few programs available.

This evening, I turned my attention to SDRSharp - an SDR suite originally targeted at the Windows platform, written in C#. Immediately, I thought of Mono, and if it would be possible to run SDRSharp on a Mac, given a Mono runtime. Mind you - the last time I looked at Mono (around 2006), the folks behind it were working on reimplementing Windows.Forms, so it wasn’t exactly ready for the prime time back then.

This writeup describes how to get SDRSharp up and running on Mac OS X

Download the Mono platform and install Xamarin Studio.

First, you’ll need to download the Mono runtime (an equivalent of the .NET Framework for platforms other than Windows). Head over to the project page and select Mac OSX - there are two packages to download and install:

Install the portaudio and rtlsdr libraries.

In order to talk to your dongle, you’ll need a library (rtl-sdr) which exposes an abstraction layer and talks to the dongle using libusb. Since this is a native library (compiled for a particular platform - in our case Mac OS X), you’ll need to build it from scratch using MacPorts. SDRSharp uses P/Invoke facilities to talk to the libraries in question. All you need to do is build them for the right architecture (i386).

Assuming you have MacPorts installed, simply issue the following commands. The +universal variant is important.

$ sudo port install portaudio +universal
$ sudo port install rtl-sdr +universal

Building the latter may take a while, or at least it did in my case - ImageMagick was rebuilt among others (go figure).

Get the SDRSharp sources.

In a directory of your choice, run the following:

$ svn co https://subversion.assembla.com/svn/sdrsharp/trunk sdrsharp

This will pull the latest SDRSharp sources from the repository.

Build the SDRSharp binary.

Fire up Xamarin Studio, open an existing project and select SDRSharp.sln in the sdrsharp directory you just checked out. Change the active configuration (Project Active Configuration) to
Release|x86. Then select Build | Build All and give it a minute or so to build everything.  

This will tell the mono runtime where to load the native libraries from. You will need at least portaudio – the latter is only required if you want to use the USB dongle.

$ ln -s /opt/local/lib/libportaudio.2.dylib libportaudio.dylib
$ ln -s /opt/local/lib/librtlsdr.0.5git.dylib librtlsdr.dylib

Run it.

Head over to the sdrsharp/Release directory and run:

mono SDRSharp.exe

20140222-sdrsharp.png

edit: Eric Brombaugh pointed out the following:

  • The Mono and IDE suggestions you made are fine for those running newer versions of Mac OS X. I’m still on 10.6.8, so I had to install older versions of Mono and MonoDevelop.
  • With the older versions of the .net tools, the SDR# .sln file wasn’t recognized, so I had to back off the version number in the .sln file by editing values in the header.

edit: Increasing performance

You may try your luck by precompiling the executable with mono --aot=full -O=all SDRSharp.exe. This will prevent the mono runtime from executing its JIT compiler, potentially leading to increased performance (it appears to help on my old Mac Mini, but YMMV). You’d then run the binary with mono SDRSharp.exe - the precompiled code will be executed automatically.

edit: SDRSharp goes closed source

The author of SDRSharp decided to close the source for the software – if you’re okay running an old version (from September 2013), then you can get those sources from github. Instead of running svn co above, do the following:

$ git clone https://github.com/cgommel/sdrsharp

I’ve attempted to run the latest binaries with Mono, but did not succeed.

comments powered by Disqus