Autodetect target on MacOS X.

Fixes #41.