Use ssh to kill single, unresponsive application instead of rebooting entire machine

Alec Jacobson

August 13, 2009

weblog/

Below is a way to avoid restarting you Mac/Linux machine just because one application has frozen the graphic user interface (by killing just that one app). Script Editor on my Mac OS X machine froze my machine, freezing not just Script Editor but the whole Graphic User Interface of my Mac. Luckily I had Remote Login enabled (Go to System Preferences > Sharing and make sure "Remote Login" is checked) and I knew my local ip address.

System Preferences Sharing Window

You can find your local ip address at the bottom of the same window above.

System Preferences Sharing Window

So I used a terminal shell on my girlfriend's computer to ssh tunnel into my frozen machine and kill Script Editor. Opening Terminal.app on my girlfriend's machine I issued:
ssh [username on my mac]@[local ip address]
Then after agreeing to the RSA fingerprint and entering the password to my Mac. I simply issued:
killall "Script Editor"
Change "Script Editor" to the name of whatever application is freezing your machine. You can issue the command:
top
to see running processes. Note: You must have ssh enabled before your machine freezes. Note: If killall doesn't actually kill the application in question, stronger kill levels exist.