launchd timed jobs

TIL about scheduling timed jobs on MacOS through launchd.

Each launchd job is described by a separate plist file, meaning you can manage launchd timed jobs by simply adding or removing a file. These files should be placed in certain folders according to the goal of the job:

/Library/LaunchDaemons/

if they need to run no matter if a user is logged in to the system or not. These tasks will be started with “root” privileges.

/Library/LaunchAgents/

and will be executed with the privileges of the user that just logged in.

~/Library/LaunchAgents/

The documentation can be found here. Examples of timed jobs can be found here.