Force quit a program in OS X terminal

Sometimes a program or process gets into an unresponsive or other undesirable state and you cannot quit it from the GUI. What you can do is to force quit (kill) it from the command line. It makes no difference if done locally or remotely over SSH.

First run ‘top’ and see if you can find the culprit. If the process is consuming too much CPU you can find it using top -o cpu.

Make a note of the PID (process ID), so if the PID is 1292, then you do:

kill -9 1292

and it’ll be gone.

If you get a no permission error then it could be that the process is owned by root or another user, n which case you can do:

sudo kill -9 1292

Enter the root password and it will quit.

Leave a Reply