Launch Daemons in MAC OSX

10.4k views Asked by At

I have written a daemon is MAC OS 10.8.

I copied the Unix executable file to startup items.

I have created a .plist file which has Label,KeepAlive flag set to YES and progrrammArguments array's Item0 as /Libray/StartupItems/updaterDaemon.

I want this daemon to run as root when a system start up hence I copied it into startupItems,but the daemon does not get launched.

Please tell what I am doing wrong or What I need to do to launch and run this daemon on system/machine start up.

Thanks in advance.

2

There are 2 answers

0
LCC On BEST ANSWER

You are confusing startup items and launchd jobs. A startup item is a special kind of bundle with certain properties. This is deprecated technology. You want to write a launch daemon. How to do this has been answered here. There are also some launchd GUIs out there which can help you to achieve your goal.

Should your job still fail make sure to set StandardErrorPath and StandardOutPath. Check those files to find out what went wrong.

0
Alkenso 'Volodymyr Vashurkin' On

You can read exhaustive overview of macOS daemons here: https://medium.com/@alkenso/macos-daemonology-d471fd21edd2

For detailed configuration of daemon.plist, use man launchd.plist or refer the article: https://www.real-world-systems.com/docs/launchdPlist.1.html