Mac OS X launchd Tips & Tricks

Background

The launchd utility is the replacement for inet, xinet, rc, crond, at and other system utilities that Apple is endorsing for Mac OS X.

Daemon and Agent Directories

There are a number of designated directories intended to contain the launchd property list files.  Apple designates a Launch Agent as an application or service that is run only when the specified user(s) are logged into the system.  A Launch Daemon is an application or service that is run independently of any logged in users.

~/Library/LaunchAgents

Per-user agents added by the user

/Library/LaunchDaemons

System-wide daemons added by the administrator

/Library/LaunchAgents

Per-user agents added by the administrator

/System/Library/LaunchDaemons

System-wide daemons provided by Mac OS X

/System/Library/LaunchAgents

Per-user agents provided by Mac OS X

Loading and Unloading a launchd entry

Properly configured property list files will be loaded automatically at system boot time.  However, it is not necessary to reboot your system to load or unload a Launch Daemon entry.

When updating a system-level daemon entry, it may be necessary to perform the commands while logged in as an Administrator and using the sudo command.

To add an entry:

launchctl load /Library/LaunchDaemons/service.plist

To remove an entry:

launchctl unload /Library/LaunchDaemons/service.plist

Examples

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>