====== LaunchDaemons (and LaunchAgents) ====== The difference between a LaunchDaemon and a LaunchAgent is that the agent will run as any user that logs in through loginwindow, while the agent can launch even before that as the root (or another specified) user. ==== Example LaunchDaemon and how to activate ==== - Create a plist like this \\ KeepAlive Label net.wgratz.cpunap ProgramArguments hwprefs cpu_nap=1 RunAtLoad KeepAlive LaunchOnlyOnce - Move it to ''/Library/LaunchDaemons'' - Load it by executing ''sudo launchctl load -w /Library/LaunchAgents/net.wgratz.cpunap.plist'' - Start it by executing ''sudo launchctl start net.wgratz.cpunap'' ==== More Links ==== * [[https://www.launchd.info|launchd.info]] * [[https://medium.com/@fahimhossain_16989/adding-startup-scripts-to-launch-daemon-on-mac-os-x-sierra-10-12-6-7e0318c74de1|Medium.com - Adding Startup Scripts to Launch Daemon on Mac OS X Sierra 10.12.6]]