Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know a specific launchd.plist file location?

Tags:

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 viewed by "launchctl list LABEL", but I cannot find the .plist file location.

I know it will be located in /Library/LaunchAgent or ~/Library/LaunchAgent or something, but I don't want to search around paths while all jobs is listed with the launchctl command.

like image 400
Kurosawa Hiroyuki Avatar asked Aug 29 '13 05:08

Kurosawa Hiroyuki


People also ask

Where is launchd on Mac?

Go to Applications > Utilities and launch Activity Monitor. Click the CPU column header to order tasks by the CPU cycles. If you can't see launchd, that's a good sign as it's near the list's bottom. If you want to see it, search for it in the search bar.

What is launchd in IOS?

The launchd process is used by macOS to manage daemons and agents, and you can use it to run your shell scripts. You don't interact with launchd directly; instead you use the launchctl command to load or unload launchd daemons and agents.

What are launch agents on Mac?

Mac LaunchAgents start when a user logs in. Unlike daemons, they can access the user interface and display information. For example, a calendar app can monitor the user's calendar account for events and notify you when the event occurs.

What are launch daemons?

Using a launch daemon is another privilege escalation method applicable to Apple-based operating systems, especially OS X. When OS X boots up, launchd is normally run to end system initialization.


1 Answers

As of macOS 10.12.6 (not sure about earlier versions) it is possible to invoke: launchctl dumpstate and you will get a wealth of information about all running processes

Look for <LABEL> = { as the first line of info pertaining to that job

Here's a one liner to get all the active daemons and their plist paths:

grep -B 1 -A 4 "active count = 1$" <<< "$(launchctl dumpstate)"

Update: Since 10.12 macOS has added other values so the grep -A n has been increased to 4 lines

like image 197
Joel Bruner Avatar answered Oct 10 '22 04:10

Joel Bruner