Adds support for mac os (same impl. as linux)
Merge pull request #1 from mikaelbr/macos

Adds support for mac os (same impl. as linux)