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
This issue comes up a lot and unfortunately locate
and mdfind
both don't show results from the appropriate directories on my system. I put the following function in my .bashrc
so I could quickly search the directories where launchctl looks for plist files.
launchctlFind () {
LaunchctlPATHS=( \
~/Library/LaunchAgents \
/Library/LaunchAgents \
/Library/LaunchDaemons \
/System/Library/LaunchAgents \
/System/Library/LaunchDaemons \
)
for curPATH in "${LaunchctlPATHS[@]}"
do
grep -r "$curPATH" -e "$1"
done
return 0;
}
Note that this only checks in the directories where launchctl
looks for files at boot-up and login. It may not find everything because jobs can be manually loaded by the user and/or other processes.
UPDATE: For those running macOS 10.12.6 or higher I would recommend using Joel Bruner's solution below.