Is there something stronger than "Force Quit"?

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?


Solution 1:

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.

Solution 2:

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.

Solution 3:

I've had situations where Force Quit, Activity Monitor, kill, and other methods didn't work, and my Mac couldn't shutdown because of it.

In this case, a sudo shutdown -r now worked when nothing else would, and is probably better than doing a hard shutdown via the power button.