6 .Nd Interfaces with launchd
9 .Op Ar subcommand Op Ar arguments ...
14 to load, unload daemons/agents and generally control
17 supports taking subcommands on the command line, interactively or even redirected from standard input.
18 These commands can be stored in
19 .Nm $HOME/.launchd.conf
22 to be read at the time
26 .Bl -tag -width -indent
27 .It Xo Ar load Op Fl wF
28 .Op Fl S Ar sessiontype
32 Load the specified configuration files or directories of configuration files.
33 Jobs that are not on-demand will be started as soon as possible.
34 All specified jobs will be loaded before any of them are allowed to start.
35 .Bl -tag -width -indent
37 Remove the disabled key and write the configuration files back out to disk.
39 Force the loading of the plist. Ignore the Disabled key.
40 .It Fl S Ar sessiontype
41 Some jobs only make sense in certain contexts. This flag instructs
43 to look for jobs in a different location when using the -D flag, and allows
45 to restrict which jobs are loaded into which session types. Currently known
46 session types include: Aqua, LoginWindow, Background, StandardIO and System.
49 .Xr plist 5 files ending in *.plist in the domain given. Valid domains include
50 "system," "local," "network" and "all." When providing a session type, an additional
51 domain is available for use called "user." For example, without a session type given,
52 "-D system" would load from property list files from /System/Library/LaunchDaemons.
53 With a session type passed, it would load from /System/Library/LaunchAgents.
55 .It Xo Ar unload Op Fl w
56 .Op Fl S Ar sessiontype
60 Unload the specified configuration files or directories of configuration files.
61 This will also stop the job if it is running.
62 .Bl -tag -width -indent
64 Add the disabled key and write the configuration files back out to disk.
65 .It Fl S Ar sessiontype
66 Some jobs only make sense in certain contexts. This flag instructs
68 to look for jobs in a different location when using the -D flag, and allows
70 to restrict which jobs are loaded into which session types. Currently known
71 session types include: Aqua, LoginWindow, Background, StandardIO and System.
74 .Xr plist 5 files ending in *.plist in the domain given. Valid domains include
75 "system," "local," "network" and "all." When providing a session type, an additional
76 domain is available for use called "user." For example, without a session type given,
77 "-D system" would load from property list files from /System/Library/LaunchDaemons.
78 With a session type passed, it would load from /System/Library/LaunchAgents.
80 .It Xo Ar submit Fl l Ar label
81 .Op Fl p Ar executable
87 A simple way of submitting a program to run without a configuration file. This mechanism also tells launchd to keep the program alive in the event of failure.
88 .Bl -tag -width -indent
90 What unique label to assign this job to launchd.
92 What program to really execute, regardless of what follows the -- in the submit sub-command.
94 Where to send the stdout of the program.
96 Where to send the stderr of the program.
98 .It Ar remove Ar job_label
99 Remove the job from launchd by label.
100 .It Ar start Ar job_label
101 Start the specified job by label. The expected use of this subcommand is for
102 debugging and testing so that one can manually kick-start an on-demand server.
103 .It Ar stop Ar job_label
104 Stop the specified job by label. If a job is on-demand, launchd may immediately
105 restart the job if launchd finds any criteria that is satisfied.
106 Non-demand based jobs will always be restarted. Use of this subcommand is discouraged.
107 Jobs should ideally idle timeout by themselves.
109 List all of the jobs loaded into
111 .It Ar setenv Ar key Ar value
112 Set an environmental variable inside of
114 .It Ar unsetenv Ar key
115 Unset an environmental variable inside of
118 Get an environmental variable inside of
121 Export all of the environmental variables of
123 for use in a shell eval statement.
124 .It Ar getrusage self | children
125 Get the resource utilization statistics for
130 .Op Ar level loglevel
131 .Op Ar only | mask loglevels...
135 log level mask. The available log levels are: debug, info, notice, warning, error, critical, alert and emergency.
137 .Op Ar cpu | filesize | data | stack | core | rss | memlock | maxproc | maxfiles
138 .Op Ar both Op Ar soft | hard
140 With no arguments, this command prints all the resource limits of
144 When a given resource is specified, it prints the limits for that resource.
145 With a third argument, it sets both the hard and soft limits to that value.
146 With four arguments, the third and forth argument represent the soft and hard limits respectively.
152 to prepare for shutdown by removing all jobs.
153 .It Ar umask Op Ar newmask
154 Get or optionally set the
158 .It Ar bslist Op Ar PID
159 This prints out Mach bootstrap services and their respective states. While the
160 namespace appears flat, it is in fact hierarchical, thus allowing for certain
161 services to be only available to a subset of processes. The three states a
162 service can be in are active ("A"), inactive ("I") and on-demand ("D").
163 .It Ar bsexec Ar PID command Op Ar args
164 This executes the given command in the same Mach bootstrap namespace hierachy
167 Print out a quick usage statement.
169 .Sh ENVIRONMENTAL VARIABLES
170 .Bl -tag -width -indent
171 .It Pa LAUNCHD_SOCKET
172 This variable informs launchctl how to find the correct launchd to talk to. If it is missing, launchctl will use a built-in default.
175 .Bl -tag -width "/System/Library/LaunchDaemons" -compact
176 .It Pa ~/Library/LaunchAgents
177 Per-user agents provided by the user.
178 .It Pa /Library/LaunchAgents
179 Per-user agents provided by the administrator.
180 .It Pa /Library/LaunchDaemons
181 System wide daemons provided by the administrator.
182 .It Pa /System/Library/LaunchAgents
183 Mac OS X Per-user agents.
184 .It Pa /System/Library/LaunchDaemons
185 Mac OS X System wide daemons.
188 .Xr launchd.plist 5 ,