Monday, July 14, 2008

Kill / force quit a program / process in OSX

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, or kill it, from the command line. You can either do this locally or by SSHing in.

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

put in the root password, and its killed.

No comments: