Programmatically run at startup on Mac OS X?

前端 未结 4 1841
悲哀的现实
悲哀的现实 2020-12-07 21:09

How do I programmatically set an application bundle on Mac OS X to run when the user logs in?

Basically, the equivalent of the HKCU\\Software\\Microsoft\\Windo

4条回答
  •  甜味超标
    2020-12-07 22:03

    The "correct" method is to create a LaunchAgent for processes you want to start at login that may have a UI and a LaunchDaemon for those that should be pure background processes. In your installer drop your plist into the correct folder, either for the user, or all users, or the system. The reason this method is superior is because you can use launchd to control how your process is run including the built-in ability to make sure it keeps running even if it crashes or is killed by the user.

提交回复
热议问题