All the changes needed to build on OSX. Enabled OSX testing on travis-ci.