Support for MacOS X

Hello,

This module does work on Mac OS X, but requires a few minor changes in order to build and use.