launchctl listshows bundle identifiers of running application, there is a number after that what is it?
With regards the number after the bundle ID, you see that for processes that are not part of the normal launchd lifecycle management (that is, things other than launch daemons, launch agents and XPC Services). It’s a unique ID that’s used to distinguish between multiple processes with the same bundle ID. It has no documented meaning that you can rely on.
If you need to do something with running applications,
launchctl listisn’t the answer. There are other, better ways of getting at such information, primarily
NSRunningApplicationdoesn’t meet your requirements, please post back with more information about those requirements.
What does it mean if pid is empty _.
It means the proces isn’t running.
What is the difference between this and [launchd agent / daemon]
A launchd daemon or agent (or XPC Service) has its lifecycle managed by launchd. The system is aware of all the events that might cause the job to start, and monitors those events on the jobs behalf. When such an event happens, the system starts the job which can then deal with the event. In addition, the system will track the activity being done by the job and can terminate the job if it’s idle (typically because the system is under memory pressure).
An application process, like Terminal, does not participate in this lifecycle. Rather, it’s both launched and terminated by the user .
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
 This is a bit of an oversimplification. Recent releases of macOS can both terminate an idle app process and keep an app process running even though the user has chosen to quit it.