a short note on handling LaunchDaemons and LaunchAgents on your Mac environment.
What do they do:
It’s a service/program/script running in the background based on specific parameters it may restart automatically, do things on a regular basis or simply start and stop servers, databases and the likes.
Where are they:
/Library/LaunchDaemons
/Library/LaunchAgents
/Systems/Library/LaunchDaemons
/System/Library/LaunchAgents
What’s the difference:
A LaunchDaemon is run by the root user or the user specified in UserName.
A LaunchAgent is run by the currently logged in user.
System Integrity Protection:
With El Capitan, Apple introduced System Integrity Protection, as a security measure to protect files and folders on your Mac - specifically those in the root directory.
This means that when working with LaunchDaemons or LaunchAgents you will need to keep them under /Library/LaunchDaemons or /Library/LaunchAgents
Here’s a working example for a LaunchAgent I use to start NaviServer: