Add support for OS X

Compatibility with OS X.

I'm a little unsure about what to do with the key type, since that could be a long on some 64-bit platforms, couldn't it?

@fbogsany @csfrancis for review.