Although Activity Monitor and other tools can tell you a great deal about running apps and other processes, there’s always something important they seem to omit. The most inveterate collector of information about apps and many other processes is LaunchServices: watch what happens in the log when you open an app, and you’ll know what I mean, with all its verbose entries detailing what it does.
LaunchServices gets to know a great deal about the apps which it opens. Among these are:
- LSASN, a unique ASN serial number by which each running app and process can be identified, such as ASN:0x0-0x34034:;
- LSParentASN, the ASN of the app which launched this app, such as ASN:0x0-0xe00e: when launched from the Dock with that ASN;
- CFBundleName, the name of the app bundle;
- LSBundlePath, the path to the app bundle;
- ApplicationType, whether foreground, background, or UIElement;
- launchedinquarantine, whether the app was in quarantine when it was launched;
- CFBundleIdentifier, the app ID, e.g. com.apple.safari;
- Usage descriptions for gaining access to certain protected resources.
One way to find all this information out, and a great deal more, is to use the command tool
lsappinfo. Although it’s one of the more complex to use, and isn’t yet able to generate reports in a convenient format such as XML, it can answer a great many questions which can’t be addressed elsewhere. It’s documented in its man page, which is extensive and fairly accurate, and by usage info in response to the command
One option listed in that usage info, but not in its man page, is
-xml, which is supposed to generate reports in XML format. I’ve been unable to get that to work, and all of its reports come as JSON-like dictionaries, consisting of key-value pairs such as
The starting point for exploring this command is
which is probably best piped into a text file for easy browsing. This lists all running apps and processes known to LaunchServices, and gives a brief summary of what it knows about them. These should all be listed in Activity Monitor anyway, so you shouldn’t see anything surprising here. If you want full details on everything running, then pipe
lsappinfo -all list
to a text file, as that tells you pretty well everything LaunchServices knows about apps and processes.
When you’ve got over having so much information in front of you, this tool is most useful for giving information about just one running app or process. To do that, use
lsappinfo -all info "TextEdit"
to show all the information about TextEdit. You can specify the app using the ASN if you prefer, such as in
lsappinfo info ASN:0x0-0x34034:
or give its bundle ID:
lsappinfo info "com.adobe.AdobeResourceSynchronizer"
In addition to getting information, there are four other valuable verbs:
listen, which reports LaunchServices events such as apps being started or brought to the front;
launch, which launches an app or process specified by path;
restart, which will restart the
launchservicesdservice at the heart of LaunchServices, and requires elevated privileges using sudo;
log, which sets LaunchServices to write more or less entries in the unified log.
The man page lists a few others too.
ASNs appear peculiar to LaunchServices and its relatives. In the man page, they are described with a structure of
ASN:0xAAAA:0xBBBB:, where AAAA and BBBB are hex numbers, with leading zeroes which can be omitted. However, the usage information corrects that to
ASN:0xAAAAAAAA-0xBBBBBBBB:, which appears to be right for Catalina. In most cases, the first number is zero, so you’re most likely to encounter ASNs given as
ASN:0x0-0x34034:, being the concise form of
ASNs aren’t assigned in a simple numerical sequence, but the second part of their number uses a pattern in which the last six digits consist of three digits repeated, e.g.
ASN:0x0-0xd23d23: To find the ASN for any running app or process, use
lsappinfo find name="TextEdit"