Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have an app that won't die: it's gone from the dock, but the window remains (with a beachball, if I mouse over it). It's using no CPU, but I want it to go away.

Is there something stronger than "Force Quit", to really really kill an app?

share|improve this question
    
I'm not sure if it's stronger, but try Apps > Utilities > Activity Monitor. Find the process, and Force Quit. If that doesn't work, note the process number, go to Terminal and type "kill #" where # is the process number. HTH –  David DelMonte Sep 20 '12 at 19:35
4  
the power button? –  Daniel Lawson Sep 20 '12 at 19:35
1  
@DanielLawson Unfortunately, these situations usually result in that. –  CajunLuke Sep 20 '12 at 19:38
1  
David: I assume that what Apple calls "Force Quit" is the same no matter how you get to it, but I tried that too, with no effect. –  Ken Sep 20 '12 at 19:54
1  

3 Answers 3

If you know the name of the app, you can check in Activity Monitor to see if it's still running there and try its Force Quit. If that doesn't work, take note of the app's process ID (pid). Go to the Terminal and type kill [pid], replacing "[pid]" with the number you noted earlier. If that doesn't work, try kill -3 [pid] and if that doesn't work kill -9 [pid]. If the process is owned by a different user (this is not likely), you may need to replace kill with sudo kill and type your password when prompted.

If the app doesn't show up in Activity Monitor or you couldn't kill it, the window may be a left-over stuck someplace else and the app simply isn't running anymore. In this case, sometimes (not always) it can work to killall SystemUIServer or killall Dock.

If none of this works, you'll have to log out and back in or reboot. The few times I've gotten to this point, the app was so stuck it prevented logging out or shutting down, so I had to hard reboot.

share|improve this answer
    
I tried all of these (including sudo, even though the process is owned by me), with no change. Will killall SystemUIServer affect any of my other open apps, like forgetting window positions? –  Ken Sep 20 '12 at 19:56
2  
gentmatt: According to kill -l, -3 is SIGQUIT, and -9 is SIGKILL ("non-catchable, non-ignorable kill"). –  Ken Sep 20 '12 at 20:09
1  
@gentmatt 3 is the QUIT signal that gives the process the ability to intercept the signal and perform cleanup. 9 is KILL is "non-catchable and non-ignorable". There are a pile of other signals you can send; run man kill (which is in the top-10 best UNIX commands ever) to see them all. –  CajunLuke Sep 20 '12 at 20:11
1  
I normally just do kill -9. -3 is no stronger than "Force Quit" –  segfault Sep 20 '12 at 20:24
2  
@BoTian True; I skip straight to -9. Sometimes I don't bother with Force Quit at all. But for a user that doesn't know what they're doing, it could work and is less likely to be harmful. It also doesn't take very long, so the time expended to expected result ratio isn't all that bad. –  CajunLuke Sep 20 '12 at 21:33

The force quit window, killall, and kill all send processes TERM signals by default. You can use killall -kill if that doesn't work.

The killall utility kills processes selected by name, as opposed to the selection by pid as done by kill(1). By default, it will send a TERM signal to all processes with a real UID identical to the caller of killall that match the name procname. The super-user is allowed to kill any process.

If you run sudo dtrace -n 'proc:::signal-send /pid/ { printf("%s -%d %d",execname,args[2],args[1]->pr_pid); }' and quit some application from the force quit window, the signal is usually shown as -15 (TERM). But when you quit a background process (or an application that isn't shown in the Dock) from Activity Monitor, the signal is usually shown as -9 (KILL).

SIGTERM is the default signal sent to a process by the kill or killall commands. It causes the termination of a process, but unlike the SIGKILL signal, it can be caught and interpreted (or ignored) by the process. Therefore, SIGTERM is akin to asking a process to terminate nicely, allowing cleanup and closure of files. For this reason, on many Unix systems during shutdown, init issues SIGTERM to all processes that are not essential to powering off, waits a few seconds, and then issues SIGKILL to forcibly terminate any such processes that remain.

share|improve this answer
    
Some good info here, but none of these variants of killing the process seems to have any effect at all on it. –  Ken Sep 21 '12 at 20:02
    
If not even SIGKILL works, the app is probably in uninterruptible sleep, and there's really nothing you can do (short of rebooting). –  Blacklight Shining Apr 30 '13 at 3:14
    
Just wondering too, if this was a user app, like mail.app or pages.app or whether this was somehow, a system process, like Spotlight, or an app background process, like Plex (that I have trouble removing). –  David DelMonte Oct 20 '13 at 6:31

As in above answers, the strongest way to terminate any process is SIGKILL, e.g. kill -9 process_id.

However, exist processes what are simply impossible to Force Quit nor kill. They called as zombie processes.

Here is a short script what will create a zombie process for two minutes:

perl -e 'if($p=fork) {print "unkillable pid:$p\n" ;system("ps -l"); sleep(120)}'

Run the above script in the Terminal and you will get output, like next:

     unkillable pid:50571
        UID   PID  PPID        F CPU PRI NI       SZ    RSS WCHAN     S             ADDR TTY           TIME CMD
        501 47380 47379     4006   0  31  0  2448416   2900 -      S                   0 ttys000    0:00.36 -bash
        501 50570 47380     4006   0  31  0  2443512   1424 -      S+                  0 ttys000    0:00.01 perl -e if($p=fork) {print "u
#THIS-> 501 50571 50570     2006   0   0  0        0      0 -      Z+                  0 ttys000    0:00.00 (perl)
        501 12795 12794     4006   0  31  0  2448296   1752 -      S+                  0 ttys001    0:00.75 -bash
        501 50123 50122     4006   0  31  0  2448296   2688 -      S+                  0 ttys002    0:00.14 -bash

If you check the status column for the unkillable process (in this case: 50571) you see the Z flag, whats mean zombie.

You can try send any kill signal (e.g. kill -9 50571) and the process will still exists. Anyway, it doesn't hurts much your system, because it's in fact doesn't exists - only occupies process table.

In the above example, in 120 seconds it will be cleared.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.