launchd — The macOS Process Manager
What launchd is
launchd is PID 1 on macOS. It combines the roles of init, systemd, cron, inetd, and xinetd into a single process. Understanding its architecture is necessary for understanding Safe Mode and for managing background processes.
Domains
launchd organizes services into domains, which are analogous to systemd scopes:
| Domain | Who it serves | When it starts | systemd analogy |
|---|---|---|---|
system | The entire machine | Boot | system units |
user/<uid> | A specific user | User login | user units |
gui/<uid> | A user’s GUI session | After WindowServer starts | session scope |
login/<asid> | A specific login session | Per-login | PAM session scope |
Service types
LaunchDaemons — run in the system domain, as root (or a specified user), no GUI session required. They start at boot and run continuously. Configuration plists live in:
/System/Library/LaunchDaemons/— Apple’s own daemons (on SSV, read-only)/Library/LaunchDaemons/— third-party daemons (writable, Data volume)
LaunchAgents — run in the user or gui domain, as the logged-in user. They require a user session. Configuration plists live in:
/System/Library/LaunchAgents/— Apple agents (SSV, read-only)/Library/LaunchAgents/— machine-wide third-party agents~/Library/LaunchAgents/— per-user third-party agents
Key launchctl commands
# List everything running in the system domain
sudo launchctl print system
# List everything in your user domain
launchctl print user/$(id -u)
# Stop a daemon temporarily (it will restart at next boot unless disabled)
sudo launchctl stop com.example.daemon
# Disable a daemon permanently (survives reboots)
sudo launchctl disable system/com.example.daemon
# Unload a specific plist (like systemctl stop + disable for one unit)
sudo launchctl bootout system /Library/LaunchDaemons/com.example.plist
# Load it back
sudo launchctl bootstrap system /Library/LaunchDaemons/com.example.plistThe Apple vs third-party distinction
launchd distinguishes Apple services from third-party services purely by filesystem path. Services in /System/Library/ are on the SSV (read-only, sealed, Apple-signed). Services in /Library/ or ~/Library/ are on the writable Data volume.
This distinction matters in Safe Mode, where all third-party services are skipped.
See also
- Safe Mode — what Safe Mode skips in launchd terms
- Recovery Mode — a completely different boot environment