*** Welcome to piglix ***

Launchd

launchd
Original author(s) Apple Computer
Initial release April 29, 2005; 11 years ago (2005-04-29)
Development status Active
Written in C
Operating system macOS, NextBSD
Type Init daemon
License Apache License 2.0
Website

In computing, launchd, a unified service-management framework, starts, stops and manages daemons, applications, processes, and scripts.

There are two main programs in the launchd system: launchd and launchctl.

launchd manages the daemons at both a system and user level. Similar to xinetd, launchd can start daemons on demand. Similar to watchdogd, launchd can monitor daemons to make sure that they keep running. launchd also has replaced init as PID 1 on macOS and as a result it is responsible for starting the system at boot time.

Configuration files define the parameters of services run by launchd. Stored in the LaunchAgents and LaunchDaemons subdirectories of the Library folders, the property list-based files have approximately thirty different keys that can be set. launchd itself has no knowledge of these configuration files or any ability to read them - that is the responsibility of "launchctl".

launchctl is a command line application which talks to launchd using IPC and knows how to parse the property list files used to describe launchd jobs, serializing them using a specialized dictionary protocol that launchd understands. launchctl can be used to load and unload daemons, start and stop launchd controlled jobs, get system utilization statistics for launchd and its child processes, and set environment settings.

launchd has two main tasks. The first is to boot the system, and the second is to load and maintain services.

Here is a simplified view of the Mac OS X Tiger system startup on a PowerPC Mac (on an Intel Mac, EFI replaces Open Firmware and boot.efi replaces BootX):


...
Wikipedia

...