launchd
In-depth entryby Apple Inc. · Service · also known as launchctl, LaunchAgents, LaunchDaemons
macOS's built-in service manager that starts, supervises and schedules daemons and per-user agents from property-list job definitions
Overview
launchd is the init and service-management system of macOS, the first process started by the kernel and the component responsible for launching every daemon, agent and scheduled job on the system. Apple documents it in the Daemons and Services Programming Guide (now in the Documentation Archive) and in the launchd and launchd.plist manual pages; the launchctl command loads, unloads, starts and inspects jobs.
A job is described by an XML property list placed in one of a few directories: /Library/LaunchDaemons for system-level daemons that run as root or a configured user regardless of who is logged in, and /Library/LaunchAgents or ~/Library/LaunchAgents for per-user agents that start at login. Keys such as Label, ProgramArguments, RunAtLoad, KeepAlive, StartInterval, StartCalendarInterval, WatchPaths and Sockets define when the job runs and whether launchd should restart it. Because launchd owns the sockets and relaunches crashed processes, programs written for it should not daemonize themselves.
On a Mac used as a server or cluster node, launchd is what keeps long-running services alive across reboots: Homebrew's brew services, PM2's pm2 startup and many monitoring agents simply generate launchd plists. Daemons are the right choice on machines without a graphical login session; agents are needed when a job must interact with the user's session.
Caveats: the plist format is verbose and error-prone, debugging relies on launchctl print and log files rather than a friendly UI, the launchctl syntax changed between the legacy load/unload and the newer bootstrap/bootout domain-based commands, and Apple's conceptual guide has not been updated since 2016.
Editorial note on uncertainty. Apple's conceptual guide is archived (2016). Current behavior of launchctl subcommands is documented only in the manual pages shipped with macOS.
Capabilities
- Launch at boot (daemons) or at login (agents)
- Keep-alive supervision and automatic restart
- Interval and calendar scheduling without cron
- Path and directory watching triggers
- Socket activation with on-demand launch
- Per-job environment, user, working directory and stdout/stderr redirection
Typical workflows
- Keep a Node or Python service running on a headless Mac Studio
- Run a nightly backup script with StartCalendarInterval
- Start a process whenever files land in a watched folder
- Replace a user cron job with a LaunchAgent
Strengths
- Built into every macOS install; nothing to add
- Survives reboots and crashes without external supervisors
- Single mechanism for scheduling, supervision and socket activation
Limitations
- Verbose XML plists and opaque error messages
- Two generations of launchctl syntax cause confusion
- Agents need a logged-in session; daemons cannot touch the GUI
- Official conceptual documentation is archived and dated
Prerequisites
- macOS
- Administrator rights for system-level daemons
Who it is for
- macOS administrators and power users
- Developers deploying services on Mac servers
- Anyone replacing cron on a Mac
Alternatives & comparison
PM2 is a user-space process manager for Node (and other) applications with a friendlier CLI, log handling and clustering; on macOS it ultimately registers itself with launchd to survive reboots, so the two are layered rather than exclusive. Docker supervises processes inside containers and restarts them by policy, which isolates dependencies but adds a VM layer on macOS. Ansible can write launchd plists across a fleet but is a configuration tool, not a supervisor. Compared with cron, launchd adds supervision and event triggers and is what Apple maintains going forward.
- Ansible
Agentless configuration management and orchestration tool that runs YAML playbooks over SSH, with collections for clouds, network gear and applications
Open sourceOpen source - Docker
Container platform combining the Docker Engine runtime, the Compose and Build tooling, Docker Desktop for macOS and Windows, and the Docker Hub registry
MixedOpen source - PM2
Production process manager for Node.js and other long-running programs with cluster mode, log handling, restart policies and boot-time startup scripts
Open sourceOpen source
Sources & verification
Primary sources consulted for this record. Claims are tied to the fields each source supports; the automated link checker re-verifies every URL on a schedule.
- Official documentationCreating Launch Daemons and Agentschecked Nov 1, 2026
https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html
Supports: capabilities, workflows, limitations
- Official documentationScript management with launchd in Terminal on Macchecked Nov 1, 2026
https://support.apple.com/guide/terminal/script-management-with-launchd-apdc6c1077b-5d5d-4d35-9c19-60f2397b2369/mac
Supports: capabilities, workflows
- Official siteDaemons and Services Programming Guide – Introductionchecked Nov 1, 2026
https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/Introduction.html
Supports: name, summary, description
Apple Documentation Archive; last updated 2016
- Confidence
- High
- Reviewed
- Nov 1, 2026
- Links
- Broken · Nov 2, 2026
Spotted an error?
More in macOS automation
Shortcuts
Apple Inc. · macOS automation
Apple's built-in visual automation app for macOS, iOS and iPadOS that chains app actions, scripts and system functions into runnable shortcuts
AppleScript
Apple Inc. · macOS automation
Apple's English-like scripting language that drives scriptable macOS applications through Apple events, run from Script Editor, osascript or other automation tools
Hammerspoon
Hammerspoon contributors · macOS automation
Open-source macOS automation app that exposes system APIs to a Lua configuration file for hotkeys, window management and event-driven scripts
Alfred
Running with Crayons Ltd · macOS system utilities
macOS launcher and productivity app whose paid Powerpack adds workflows, clipboard history, snippets and custom searches
Karabiner-Elements
pqrs.org (Takayama Fumihiko) · macOS system utilities
Free, public-domain keyboard customizer for macOS that remaps keys and defines complex modifications through JSON rules at the driver level
Keyboard Maestro
Stairways Software Pty Ltd · macOS automation
Commercial macOS macro application that runs sequences of actions from hotkeys, typed strings, application, time, device and system triggers