Or, you could use the kill command. I've had one instance where the MacOS GUI refused to respond. Instead of doing a hard restart, I used SSH to log into the machine, locate the problematic app ...