Add implementations for macplatform.

Most of the work is done by @v17al