MacOS port: first implmentation