Remotely log into unresponsive Mac and kill processes

This post was published more than a few years ago (on 2016-08-22) and may contain inaccurate technical information, outmoded thoughts, or cringe takes. Proceed at your own risk.

A few months ago, I was drawing in Adobe Illustrator for an animation we were producing, and I was having trouble with my laptop bogging down and becoming completely unresponsive when Illustrator threw up its hands at copying or pasting the hundreds of tiny switches and buttons I had drawn on a retro-style computer bank.

When that happened, my options were basically to wait 10–15 minutes for Illustrator to get itself together and return control, or log in remotely and kill the process. Thankfully, Gil showed me how to do the latter. Here are the instructions, in case I need them again:

  • ssh into the Mac from a remote system. I have Panic's great SSH client, Prompt, on my iPhone or iPad, just for such an occasion.
  • top -o cpu to see what processes are using up most of the cpu
  • ps auxwww to get more detail. You can also pipe it with ps auxwww | head to see column headings. The important ones are the first four: USER, PID, %CPU, and %MEM
  • ps auxwww | grep -i adobe to search for processes with 'adobe' in the name (or whatever app you suspect is dragging things down)
  • Note the process ID (PID) of the CPU or memory-hogging app, and try to kill the process with sudo kill -9 [PID]; in my case this did not free the system
  • If killing the individual app fails, try ps auxwww | grep -i loginwindow and look for the process belonging to my USER, make note of the PID, then sudo kill -9 [PID] to force logout of your user and quit all apps.
  • Log back in and all should be well, probably?