How to know a specific launchd.plist file location?

后端 未结 7 948
天涯浪人
天涯浪人 2021-01-31 10:25

Is it possible to know the .plist file location which is loaded into the launchctl command?

The label name is listed with \"launchctl list\" and its contents can be view

7条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 10:32

    In recent versions of macOS you can use the launchctl print command. You have to know which domain it's running under, e.g. system or gui/. There are a few other domains you can find in the man page, but so far I have only seen services running under these two. Examples:

    % launchctl print gui/$(id -u)/com.apple.cloudphotod  | grep path
        path = /System/Library/LaunchAgents/com.apple.cloudphotod.plist
    
     % launchctl print system/com.openssh.sshd | grep path 
        path = /System/Library/LaunchDaemons/ssh.plist
        stderr path = /dev/null
    

    I believe this command was implemented in High Sierra or thereabouts.

提交回复
热议问题