osx support (no merge plz)

This will be a longer lived pull request. It is hear for feedback as I rip apart the mess that is wip-osx, into a sane patch series.