Mac – way to list—and kill—running processes on Mac OS X in a Windows “Ctrl+Alt+Delete”-like way

mac

So, what do you do on a Mac when a process (as opposed to an application) is hogging CPU, swamping your machine, and you need to kill it?

I know you can use top or open “Applications > Utilities > Activity Monitor” and kill it from there.

But what happens when the process is already using so much CPU that doing either of those tasks is impossible?

On Windows, you can just do ctrl+alt+delete and the process list will reliably open. So no matter how much your computer is thrashing, you always have access to the list of processes.

On Mac OS, there’s cmd+alt+escape, which reliably shows running applications. Fine when it’s an application causing the problem. But: what do you do if it’s a process?

Best Answer

Based on your desire to kill an individual process, I'm assuming that you are ok with a solution at the Terminal. The Terminal is pretty light so should be responsive even if your system is swamped, or if you're logging in via ssh.

Beyond the basic kill command, which kills processes via their pid (which you'd need to get from either a ps command, or the Activity monitor), a neat trick at the terminal is the killall command, which allows you to kill a process by name rather than pid.

For example, if you know the name of your process is my-prog-0 or whatever, you can go to the terminal and do:

% killall my-prog-0

There are a number of good options (see man killall for more info):

-s : Shows the kill commands that will be generated so you can be safe.
-u : Limits to a specified user

One thing to note about OS X is that some system processes will be automatically restarted if they are killed by the launchd daemon (I think??). For example, if the Dock is not responsive you can do a killall Dock and it will restart automatically.