Easily create and install Launch Daemons on macOS or OS X

I recently needed to have a script execute on a daily basis - previously this would have been a task for cron however it's been deprecated (yet still all the...

I recently needed to have a script execute on a daily basis - previously this would have been a task for cron however it’s been deprecated (yet still all there) in macOS since something like 10.4. The accepted way to do it now is via a Launch Daemon. Simple in theory, but easier said than done. It’s far easier to edit a single line in a crontab entry (even if you have to look up the unique syntax of the crontab) than it is to create a Launch Daemon xml .plist file. Fortunately, Nathan Witmer has created Launched - a web-based tool to create launchd plist files. From here it was easy - I created my script as per normal and put it in /usr/local/bin I made up a name for my daemon, set the command to /usr/local/bin/my_amazing_script.sh and configured it to run every day at 8pm (ironically, using the cron syntax to schedule it). After hitting the Create .plist button, I was given my entire plist to copy and paste, as well as a couple of snippets to install the plist via using curl to get it from Launched, copying it to /Library/LaunchDaemons and using launchctl to load it.

Keep This Useful

Spotted something outdated or unclear?

If a step has changed, a screenshot no longer matches, or something here just does not work the way it should, get in touch and we will take a look.