

It loads the parameters for each launch-on-demand user agent from the property list files found in /System/Library/LaunchAgents, /Library/LaunchAgents, and the user’s individual Library/LaunchAgents directory.When a user logs in, a per-user launchd is started. The process for per-user agents is similar. When the system shuts down, it sends a SIGTERM signal to all of the daemons that it started.As requests for a particular service arrive, it launches the corresponding daemon and passes the request to it.It launches any daemons that requested to be running all the time.It registers the sockets and file descriptors requested by those daemons.

It loads the parameters for each launch-on-demand system-level daemon from the property list files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/.As part of that initialization, it goes through the following steps: A user agent is essentially identical to a daemon, but is specific to a given logged-in user and executes only while that user is logged in.Īfter the system is booted and the kernel is running, launchd is run to finish the system initialization. These per-user processes are referred to as user agents. If you are running per-user background processes for OS X, launchd is also the preferred way to start these processes. It also improves the ability of administrators to manage the daemons running on a given system. Using launchd provides better performance and flexibility for daemons. If you are developing daemons to run on OS X, it is highly recommended that you design your daemons to be launchd compliant. It is launched by launchd, typically as part of the process of logging in the user.Ī third party launchd agent should be installed by adding a property list file to the ~/Library/LaunchAgents directory (to be invoked just for this user) or /Library/LaunchAgents directory (to be invoked for all users).Ĭreating Launch Daemons and Agents The difference between an agent and a regular application is that an agent typically displays no GUI (or a very limited GUI).Ī launchd agent is like a launchd daemon, except that it runs on behalf of a particular user. The difference between an agent and a daemon is that an agent can display GUI if it wants to, while a daemon can't. the agent can launch the calendar application when certain events occur.each agent has access to that user's calendar.there should be an instance of the program per GUI login session.A calendar monitoring program is a good example of an agent because: Agents are useful because they can do things that daemons can't, like reliably access the user's home directory or connect to the window server. For details, see the ist man page.Ī third party launchd daemon should be installed by adding a property list file to the /Library/LaunchDaemons directory.Īn agent is a process that runs in the background on behalf of a particular user. This file allows the daemon to be launched based on a variety of criteria (connections to listening sockets, items being modified in the file system, periodically, and so on). On current systems there is only one recommend way: launchd.Ī launchd daemon is configured by a sophisticated property list file.

OS X LAUNCHD LOCATIONS MAC OS X
Historically, Mac OS X had a number of different ways to start daemons (for details, see Deprecated Daemonomicon). A web server is the perfect example of a daemon. A daemon cannot display any GUI more specifically, it is not allowed to connect to the window server. LaunchDaemon and LaunchAgents Daemon Ī daemon is a program that runs in the background as part of the overall system (that is, it is not tied to a particular user).
