How does one check whether the OS X "disabled" flag for launchd services is set?
Solution 1:
Disables are now (as of 10.6.x) stored in /private/var/db/launchd.db/com.apple.launchd/overrides.plist, as entries like:
<key>com.apple.AppleFileServer</key>
<dict>
<key>Disabled</key>
<true/>
</dict>
You could parse this file to see which launchd items are overridden, but the file is set to root access only ("-rw------- 1 root wheel"), and there's no guarantee that Apple won't change how things are stored again in 10.7...
Also, I don't know any way to enable an existing launchd item to load on next boot without also loading it immediately. (If it's a new item, no problem: make sure it has Disabled=false in it, and drop it into /Library/LaunchDaemons.)
Solution 2:
For new versions of macOS, launchctl
syntax and commands have changed.
The following was tested on macOS High Sierra (10.13.4
):
launchctl print user/$(id -u)
# For GUI domain (effectively "flat" with login domain)
# See man launchctl for details
launchctl print gui/$(id -u)
You can view many properties of services on the system attached to your user with variants of the launchctl print
and launchctl list
commands. For example, to see the state of the disabled flag, look for a section like this:
disabled services = {
{
"com.apple.macbuddy.icloudsetup.user" => false
"com.apple.ManagedClientAgent.enrollagent" => true
"com.apple.FileStatsAgent" => false
"com.apple.FolderActionsDispatcher" => true
"homebrew.mxcl.postgresql" => false
"com.apple.appleseed.seedusaged.postinstall" => true
"homebrew.mxcl.mysql" => false
}