Benches macOS

15

kill command doesn't do anything - Is…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

A few times now I have had trouble getting various apps to quit. I try using Force Quit, but that almost never works.

Aside on Force Quit: With apps that are not responding, I choose Force Quit from the Apple menu, then as I select apps and click the Force Quit button, they obediently disappear from the list, but nothing seems to actually be happening - the app is still there, and when I close and reopen the Force Quit dialog, they're back in the list! Force Quit from the context menu of their dock icons also does nothing...

Anyway, so having tried Force Quit and not gotten anywhere, I open up a Terminal window (thinking, here we go, OS X is Unix so I can get right down to the low-level stuff here). I use ps to find out the PID of the app's process and use kill -9 <PID> to try to terminate it manually.

...but NOTHING! If I run the ps command again, the process is STILL THERE!

So now I'm thinking, hang on a second! This is supposed to be Unix, uber-low-level control! I've never had the kill command not work on any other Unix system...

Maybe I'm a paranoid conspiracy theorist or something, but this experience has made me wonder if OS X really is Unix and not some kind of Unix emulation wrapped around a proprietary kernel.

Someone please put my fears to rest (and oh yeah by the way also help me with the kill command thing).

15 replies

Sign in or join Beachball Help to reply.

  1. 0

    Bill Scott

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    There are actually two versions of OS X circulating. One is the standard implementation that is essentially a superset of BSD unix. The other is a pirated version circulated by extraterestrial members of the Trilateral Commission in collaboration with the Queen of England and Lyndon Laroosh. It sounds like you have one of the latter copies, so your paranoia about a conspiracy is completely justified.

    Even then, there is hope.

    Try issuing

    sudo kill -9 <PID>

    or

    sudo killall <processname>

    or even

    osascript "quit X11"

    to quit, for example, X11.

    If that doesn't work, it means your computer really is possessed by aliens and you are better off just sending it to me for safe disposal.

  2. 0

    bdinmstig

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    ROTFL

    It's good to see some people there are still some people left who have both a sense of humour and the ability to be funny.

    Thank you for your helpful, informative, and amusing answer. I will try the above next time this happens.

  3. 0

    Lee Cullens

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Good gosh Bill, I wasn't aware - thanks for the heads up ;')

    Lee C :<))))))))))

  4. 0

    Gary Kerbaugh

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi Bill,

    I'm saving this post; it's the best I've read in years! The reference to the Trilateral Commission alone is priceless. I think I read that the Freemasons are also involved. The offer to handle disposal is so selfless; Lord Gotama would be proud.

    --

    Gary

    ~~~~

    The problem with most conspiracy theories is that they

    seem to believe that for a group of people to behave in a

    way detrimental to the common good requires intent.

  5. 0

    bdinmstig

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    sudo kill -9 <PID> worked by the way - thanks again!

    Any idea about the Force Quit problem?

  6. 0

    Gary Kerbaugh

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi bdinmstig,

    If "kill -9" didn't work but prefacing it with sudo does work, it's probably a permissions issue. The process must be owned by root or another user. Of course it could other things. Zombied processes can't be killed by any means other than rebooting.

    --

    Gary

    ~~~~

    Thank goodness modern convenience is a thing of the

    remote future.

    -- Pogo, by Walt Kelly

  7. 0

    Deano

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Okay, I have to admit that I am a GUI dude. As much as I like UNIX, I prefer the GUI If, you are like me, use Activity Monitor, and it can tell you a whole lot about stuck processes. And even kill stubborn ones.

    You can still send your computer to Bill if you want, but all I ask for is a + vote.

  8. 0

    bdinmstig

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I'm with you there Deano. And the simple reason is, if you can use the mouse instead of the keyboard, that leaves your other hand free for, um...

    Anyway, I like the command-line interface, but only when it's easier/necessary - and if the GUI is built right, that's never.

    I'd like to see Force Quit work as it's supposed to. I see no reason why Force Quit can't weild the same power as kill -9.

  9. 0

    Gary Kerbaugh

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi bdinmstig,

    > I see no reason why Force Quit can't weild the same

    power as kill -9.

    Power isn't the only issue; "kill -9" doesn't give the app the opportunity to clean up after itself. Thus you don't want to use it unless the app is in such a bad state that it can't clean up after itself anyway. The GUI might be easier but it generally doesn't offer options and almost never offers the wide range of options that the command line interface does. That's why you'll find quite a number of people on this discussion that don't agree with Deano.

    --

    Gary

    ~~~~

    Look, I'm about to buy me a double barreled sawed off

    shotgun and show Linus what I think about backspace and

    delete not working.

    -- some anonymous .signature

  10. 0

    Daniel Macks

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    What signal does Force Quit send? I think I remember reading that if you do a second Force Quit on a process, it kills it harder...wish I remember the details, hope I didn't just make that up as wishful thinking to assuage the "everything must have a GUI implementation crowd"🙂

  11. 0

    Bill Scott

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Pushing the elevator button at 10 Hz makes it arrive sooner too.

  12. 0

    Deano

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I knew I was going to open a can of worms, but I do not want to sound dogmatic on my GUI preference. I understand the power of the CLI and use it often, but for simple understanding of what is going on, the GUI is much easier for those of us who still remember Mac OS 6.

  13. 0

    Daniel Macks

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Well, faster than at 0 Hz, that's for sure.

    FWIW, Activity Monitor's "quit process" sends SIGINT.

  14. 0

    Karl Zimmerman

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Not sure about the Dock, but a simple test on Activity Monitor shows that Quit > Quit sends SIGINT; Quit > Force Quit sends something else (probably -9 aka SIGKILL). It would make sense for Force Quit (even from the Dock) to send -9 -- what if the process is hung in its exit cleanup?

    Note that the problem initially reported & solved here wasn't "kill -9 doesn't work as it ought", it was "kill -9 doesn't work". Even on standard UNIX, one user can't just kill -9 any process at all -- they have to
    own the process. Neither kill -9 from the command line nor Force Quit from the Dock or Activity Monitor can
    or_should kill processes not owned by the logged-in user -- unless the user authenticates as admin. Actvity Monitor, if asked to quit a process not owned by the user, will prompt for authentication -- kill(1) will just refuse.

    Looks to me like it works just fine!

    [Simple test : create a plaintext file containing:

    #!/bin/sh

    tellUs ()

    {

    echo "SIGINT caught, ignored." >&2

    }

    trap tellUs SIGINT

    while true; do

    sleep 5

    echo "running..."

    done

    Save it, make it executable; execute it in a Terminal window. Try typing ^C. Try Quit > Quit from Activity Monitor. Try Qut > Force Quit from Activity Monitor. Restart it; try kill, kill -9, Activity Monitor variations from another account.]

  15. 0

    Nils C. Anderson

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    zombie processes can't be killed, because there is nothing to kill, the process has already exited. They are waiting for there parent process or init (which seems to have been replaced by launchd, on OS X) to wait(2) on them. zombie process have released all of there resources. They only occupy a slot in the process table.

    When a process goes into the kernel, all signals that have been sent to it, remain pending until just before it returns to user space. So a process that gets stuck waiting for some event to occur, will appear to be unkillable, and in the worse case, as Gary mentioned, can only be removed from the process table by a system reboot.

    Andy