Added MacOS support.

Fixed MacOS compilation.
Fixed mtio usage.