Finally found a GUI utility to view/edit agents & daemons for OS X Mountain Lion 10.8.2 (should work with anything from 10.5 or newer)
OS X uses the “Mac launchd” facility to manage the startup of system services and to provide functions which may have previously used cron.
It works by utilizing PLIST scripts for three types of startup agents:
- /Library/LaunchDaemons – scripts in this folder run even if no users are logged in. Useful for creating a “system service” to automatically startup whenever the operating system is booted.
- summary: load on system startup; run as root.
- /Library/LaunchAgents – scripts in this folder run after any user has logged in. These are often configured to run as root, but can run as any user.
- summary: load on any user login; run as user.
- $HOME/Library/LaunchAgents – scripts in this folder run for a the specific user login and run under that user’s account.
- summary: load on specific user login; run as user.
The plist is an XML file which specifies a command to run and a variety of options (parameters). The specified command can be a shell script, application, or most anything available to you at Terminal‘s command line.
Editing agent and daemon plist scripts manually can be a bit cumbersome for infrequent changes. Some requirements include:
- creating the plist in the correct location and setting the file permissions.
- use launchctl command with load, unload, start, stop, remove, submit, or list options.
- manually editing the plist file with the correct keys and parameters.
- moving back and forth between terminal window command line activities, text editing, and file management.
- keeping track of desired results, the changes made to the system, and the actual results. You do keep track of these things right?
In the interest of simplifying things, I went looking for a GUI utility.
Given the jargon laden nature of this topic, it’s quite likely there may be other options out there which I haven’t found. The concept of managing daemons is a common one Mac inherited from it’s Unix origins and shares with Linux. Additionally, Apple has been changing “under-the-hood” aspects of OS X for several releases now. Finding a combination of searchable keywords specific to a GUI utility for Mountain Lion’s launchd and launchctl features appeared to be getting me nowhere.
Eventually I found an older piece of software which seems to fill my needs quite well. Lingon 2.1.1 by Peter Borg. Although this older version is no longer supported, it is still available from source forge.
Lingon 2.1.1 features include:
- Display existing items and view/edit their plist files.
- Easily enable or disable existing items.
- Creates the plist file when creating a new agent.
- GUI provides a “basic mode” to view or edit some of the parameters.
- It also provides “expert mode” to view or edit the full XML. Includes a list of about 40 parameters which can be inserted.
- Expert mode also validates the plist to be a valid file. (Verifies structure, but doesn’t magically verify parameter settings for you… you still have to do some work yourself.)
- Source code is available as an Xcode project dated 2008-12-18. It successfully builds and runs under Xcode 4.5.2 on Mountain Lion 10.8.2 I needed to set the project to use the 10.8 SDK I have installed, and it threw a few minor minor warnings about syntax. But it’s pretty good to be able to compile and run four year old source code with no changes.
note: Newer versions of the Lingon app are only available from the Mac App Store and (due to GateKeeper / app rules) no longer have the ability to work on systemwide agents/daemons. The App Store version is limited to the current log’d in user only. The developer doesn’t seem to be offering an alternative update out side of the App Store; but the older 2.1.1 (2008-12-18) still works under Mountain Lion OS X 10.8.2 and is able to create or edit new agents and daemons.
If you’re only working with processes for the current log’d in user, “Lingon 3″ is currently available on the Mac App Store for $5. For a single user setup or any system using FileVault2 (which requires a user login to unlock the drive before anything will startup), the App Store version may be all you need.
Lingon 2.2.1 is also still available in the Mac App Store for $5 as “Lingon“. Satisfied with the version downloaded from sourceforge, I was curious to see how whether the older App Store version would still work with Mountain Lion.
$5 seems a fair price for a useful utility and an expensive test of whether Mountain Lion 10.8.2 is imposing any restrictions on pre GateKeeper App Store software. It pre-dates Apple’s latest GateKeeper app requirements, but worked just fine.