OS X build

Just thought I'd try again with recent OS X version. Still works with some minor changes.