2

I created a daemon for running into Mac OS X platform. I made an installer using PackageMaker and the Daemon is installed without problems. It seems that after the installation has finished, I need to reboot the system in order to have the daemon running. I am wondering if I can load and start the Daemon without forcing the reboot?... I have some ideas about it but not sure if is the right way, for example:

  1. Using a shell script that invoke the command: $sudo launchctl load /Library/LaunchDaemons/myService.plist

  2. Using ServiceManagement.framework to manage privilege escalation on the application that will be using the Daemon while is running so the App can if necessary install and load de service. I have to say that the work of the service is required only when a Cocoa App is active.

If any better idea please let me know it people. :D

willyMon
  • 612
  • 8
  • 19
  • If you are asking password at the time of installation you should add `sudo launchctl load /Library/LaunchDaemons/myService.plist` in installer script. – Parag Bafna Oct 31 '12 at 17:29

1 Answers1

0

You should add the daemon load command in the postinstall script of your package (Your Option 1). Anyway, the daemons do have launch-on-demand options so your daemon will only be loaded only if your app requests to load it.

Vikram Singh
  • 1,726
  • 1
  • 13
  • 25