2

Within Activity Monitor.app it's easy to visually identify a hung app by seeing its name in red text: red text How can such hung app statuses be identified from the shell (Terminal.app) and the PID(s) of such processes retrieved?


UPDATE (The answer below linked to a great post, but doesn't yet contain the entire answer):

First step appears to be to identify the hung process by using spindump:

sudo spindump -notarget 5  -timelimit 60 -stdout -noFile -noProcessingWhileSampling   -aggregateStacksByProcess | grep -B 8 "Unresponsive for"

I will now need to extract out the PID (probably trivial) and this should do it. It would be nice if there were a more effective method... ie, it would be nice if we could discover how Activity Monitor itself is really doing this so quickly / effectively...

1

This is actually not straightforward to do, but other people have run into this and written codes you could use. See here.

  • This is definitely a step in the right direction. I'm going to have to work on this a bit further once I have some time to both reproduce a particular hang and then to parse out the PIDs from the output of sudo spindump -notarget 5 -timelimit 60 -stdout -noFile -noProcessingWhileSampling -aggregateStacksByProcess | grep -B 8 "Unresponsive for" – ylluminate Jun 13 at 16:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .