implement autostart support for osx
Merge pull request #349 from haiwen/support_autostart_osx

implement autostart support for osx