Support OS X build

These are the changes I had to make to build the package on OS X (Mavericks). Note that I'm not very familiar with OS X so there may be better ways to do it, but this is what worked for me and hopefully other people.