Build on OS X.

Just a few minor changes to build and run on OS X.