macOS runs dozens, maybe even hundreds, of services. Some like logd run in the background all the time, while others are scheduled to run every now an

Explainer: macOS scheduled background activities

submited by
Style Pass
2021-09-10 08:00:05

macOS runs dozens, maybe even hundreds, of services. Some like logd run in the background all the time, while others are scheduled to run every now and then. The most prominent example of the latter are Time Machine backups performed by backupd, which should occur every hour. This article explains how those activities are scheduled.

The traditional service for running scheduled background activities in Unix is cron, and that’s what the first versions of Mac OS X shipped with. But Dave Zarzycki was busy designing and coding a replacement service for cron and a lot more besides: launchd, which arrived in Mac OS X 10.4 Tiger, in 2005.

In this new model, one of the early tasks of the kernel after it has been booted is to load launchd, which then becomes the master launcher and launches everything else, in conjunction with launchctl and property lists in LaunchDaemons and LaunchAgents folders in Library folders. In replacing cron, launchd took on the responsibility of running scheduled background activities too.

The first couple of years with launchd had their moments, as it took a while before it became reliable. Just over two years later, when Apple released Time Machine in Mac OS X 10.5, it was scheduled to make backups every hour using launchd. The disadvantage of that was that, like cron, launchd isn’t flexible on timing: the moment that it decides to run a large backup could coincide with intense user activity, resulting in slowing of response to the user and prolonged backup duration.

Leave a Comment