Home

LaunchAgent

LaunchAgent is a configuration entity used by the macOS service management system, launchd, to describe a job that should be started, kept alive, or monitored. A LaunchAgent is implemented as a property list (plist) file that specifies the program to run, how it is invoked, and its scheduling or persistence requirements. LaunchAgents differ from LaunchDaemons in scope and privileges: LaunchAgents run in a user context, while LaunchDaemons run with elevated privileges at system startup or during boot.

LaunchAgents can be placed in user or system locations. Per-user agents are typically stored in the user's

A LaunchAgent plist includes keys that define its behavior. The Label key provides a unique identifier. The

Management of LaunchAgents uses the launchctl command. Administrators or users can load, unload, enable, or disable

Library
folder
(for
example,
~/Library/LaunchAgents),
while
system-wide
agents
reside
in
/Library/LaunchAgents
or
/System/Library/LaunchAgents.
LaunchDaemons,
by
contrast,
are
kept
in
/Library/LaunchDaemons
or
/System/Library/LaunchDaemons.
When
a
user
logs
in,
the
corresponding
LaunchAgent
is
loaded
by
launchd
into
the
user
session;
LaunchDaemons
are
loaded
by
launchd
at
system
startup.
Program
or
ProgramArguments
keys
specify
the
executable
and
its
arguments.
Optional
keys
control
timing
and
lifecycle,
such
as
RunAtLoad
(start
when
loaded),
KeepAlive
(whether
to
restart
the
job),
StartInterval
or
StartCalendarInterval
(scheduling),
and
UserName
or
GroupName
(execution
context).
StandardOutPath
and
StandardErrorPath
can
redirect
output.
agents.
In
modern
macOS,
commands
may
target
specific
domains
(such
as
gui/UserID)
or
employ
bootstrap
methods
to
bring
agents
into
the
running
context.
LaunchAgents
are
commonly
used
for
background
tasks,
periodic
maintenance,
or
launching
user-level
applications
at
login.