Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.
launchctl list

launchctl bstree

These show which jobs are active, dormant or inactive, allegedly. I have never seen an inactive job personally. Even ones that I have tried to inactivate show as 'D'

Now, in /var/db/launchd.db there are textfiles that show, per user, which jobs are actually disabled, lamentably, the old -w switch was deprecated, and the Disabled key in the plist is only a default. I don't know why they would do such a thing, there seems to be no way to say definitively

"Service X is off."

It seems that running as root I should be able to ask what is on, and what is off. What am I doing wrong?

EDIT: What I was doing wrong was ignoring

/var/db/launchd.db/com.apple.launchd/overrides.plist

Which is the definitive place apparently for the current state of a daemon.

Handily, this means that the default will be in the plist files in /System/Launch* /Library/Launch* ~/Library/Launch* and one can just blow away ( errrm copy and move ) that directory and reboot to a default set. This worked for me recently.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

The true status is whether a job is currently loaded or not.

Have a re-read of the launchd philosophy - items 4 and 1 explain that launchd waits till the last moment before starting the child task and that process will come and go with launchd timing, throttling and disabling tasks as needed.

These are all logged to system logging. top and ps will show you the current processes. I suppose you could simply attach launchd to a debugger if you need to know the exact state since the current code doesn't make a list to your liking.

share|improve this answer

The launchd GUI LaunchControl will give you a list of services along with their respective status. You can see if a job has been disabled by looking at the check box next to the job name. A colored check box indicates that the Disabled key has been overridden: a red checkbox stands for a permanently disabled job, a green one for a permanently enabled job.

LauynchControl

share|improve this answer

Thanks to the info by chiggsy, we were able to fix a problem in Mountain Lion, where org.apache.httpd was displayed as not running in "launchctl list", but de-facto it was running after reboot, preventing MacPorts httpd to run propperly. Edited the overrides.plist file and set org.apache.httpd disabled=true did the trick. Must be something happening on update from Lion to Mountain Lion which enabled com.apache.httpd.

share|improve this answer
1  
Services in /System/Library/LaunchDaemons/ are only shown when launchctl list is run as root. launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist and /usr/sbin/apachectl stop would also modify overrides.plist. –  ؘؘؘ Aug 15 '12 at 21:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.