How to find the PID(s) of a hung app in macOS from the shell (Terminal)?
This is actually not straightforward to do, but other people have run into this and written codes you could use. See here.
This is actually not straightforward to do, but other people have run into this and written codes you could use. See here.