add conditional compilation to build on OSX

Ok to lose the `-r` here?