This is a work in progress, I will be... Full Story
By Manny Fernandez
December 9, 2019
Killing a Process in macOS
Sometimes in the course of your day, you may run into an app or a process that wants to behave like a 13 year old boy. As I am writing this, my 13 year old is pushing his luck with my wife and is about to get a lesson in what a Cuban woman is capable of. When this happens, you need to kill
the process (not the child). In this example, I am looking to kill a Snagit
process.
Quitting the App
One of the quick and easy ways to quit a process that is misbehaving is by pressing the following keys
⌘ ⌥ ⎋
That is COMMAND
OPTION
and ESC
Normally, you would see one of these showing not responding
. You would select it as I did with the Firefox
and then choose Force Quit
Using Activity Monitor
Some applications do not show up in the previous step. Usually these are helper
applications and other processes that are running in the background. To kill these apps and processes you need to launch the Activity Monitor. To launch Activity Monitor
you can hit the ⌘ and the Space bar
Once you have the Spotlight
search bar, start typing activity monitor
and then hit enter.
On the right hand side, you have a search
window. I typed snag
and enter to search the processes. As you can see, I found two. You can click on any of the processes you want to kill, then choose the X
on the top left.
Now you can choose to Quit
, Force Quit
or Cancel
(see below section for the difference between quit and force quit)
Command Line Killing
If you are like me and you enjoy the CLI, you can do the same process as above but via the command line. First you will want to identify the process you are trying to kill. For that you can use the ps
command which stands for Process Status
. You can use it in conjunction with the grep
command. By the way, this also works for Linux.
Above, you can see that I typed ps -ax | grep snagit
. This filters out all the other processes and shows me the ones that contain snagit
in their names. You can see the PID on the left hand side.
To see the options you can use with ps
you can run the following command man ps
.
Also above, you see that I issues the kill -9 25103
which is the pid (process id) number for the process. Below is the options to use with the kill
command. You can get this info by using the man kill
command.
Some of the more commonly used signals: 1 HUP (hang up) 2 INT (interrupt) 3 QUIT (quit) 6 ABRT (abort) 9 KILL (non-catchable, non-ignorable kill) 14 ALRM (alarm clock) 15 TERM (software termination signal)
The -9
is equal to Force Quit
where -3
is equal to Quit
Another way to find the pid is by using the top
utility. This should come standard with most Linux distros as well as the macOS. You can run this by simply typing top
on the cli and enter.
Top will update itself and show different processes. You can see the highlighted processes and their corresponding PIDs on the left side. To see more options with top
use the man top
from the cli or you can visit this site.
To Quit or Force Quit, that is the question
There is a difference in ‘Quit’ and ‘Force Quit’
Quit: This is the same as choosing File > Quit within an app. The process quits when it’s safe to do so. If quitting the process could cause data loss or interfere with another app, the process doesn’t quit. Also, if you are not the Administrator it will ask you for the Admin password.
Force Quit: The process quits immediately. If the process has files open, you may lose data. If the process is used by other apps or processes, those apps or processes could experience problems.
Hope this helps
Recent posts
-
-
I have been playing with the free version of... Full Story
-
In my day job, I am on a lot... Full Story