Installing Launch Daemon?

Hi everyone,

I have an executable that handles NSXPC connectivity between apps that I'm installing, and I would like to install it as a launch daemon. I can do this locally with ease by sudo adding the .plist file to /Library/LaunchDaemons/, but when I tried to do this as part of the installation process, the installer complains about lack of permissions, despite me using su in the post install script:
Code Block
/usr/bin/su - ${loc_user} -c "cp ${plist_path} ${plist_target}"
/usr/bin/su - ${loc_user} -c "chown root:wheel ${plist_target}"
/usr/bin/su - ${loc_user} -c "chmod 644 ${plist_target}"

Is there a best practice when it comes to these services? Currently the plist file and the executable are part of a framework that I am installing.

Thanks!
Answered by DTS Engineer in 646192022

Is there a best practice when it comes to these services?

The best practice here is to install these files as part of your installer package contents rather than from a post-install script.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer

Is there a best practice when it comes to these services?

The best practice here is to install these files as part of your installer package contents rather than from a post-install script.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thank you. Is there an example of how to do it that I could look at? I've examined the Distribution XML reference and guidelines on creating Agents and Daemons, but I could not find how I should approach the installation. I have no experience creating installers on OS X.

Is there an example of how to do it that I could look at?

I’m sorry but I don’t support the installer and, as such, I don’t have any direct references for you. My Signing a Mac Product For Distribution post has some info on creating the simplest possible installer package but I’ve never tried to extend that to install a daemon.

If you get stuck I recommend that you open a DTS tech support incident and talk to DTS’s installer specialist.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thank you!
Installing Launch Daemon?
 
 
Q