Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to kill a zombie process or find it's parent process on a Mac using the Terminal?

share|improve this question
    
possible duplicate of how to kill process in Mac OS X and not have it restart on its own –  soandos Feb 16 '12 at 8:13
1  
@soandos Not a duplicate, as that topic isn't about zombies. None of the kill signals work for zombies IIRC. I've had this happen before. –  Daniel Beck Feb 16 '12 at 9:03
    
Usually one can kill zombies if the parent process is known but this requires killing that one too, which is not always a pleasant choice. Therefore I am wondering if there is another solution to this. –  eFrane Feb 16 '12 at 10:45
add comment

3 Answers

up vote 6 down vote accepted

Hack Saw says:

Sadly, it appears that killing of zombies is all about killing the parent, and if the parent is /sbin/launchd, you can kill it only with rebooting.

It would be a Very Bad Idea to kill launchd, but you can tell it to HUP.

Try sudo kill -s HUP 1

That will cause launchd to reinitialize without restarting. This has worked for me in the past (wrt. removing zombie entries).

share|improve this answer
add comment

zombie processes are already dead and cannot be killed. They should be removed from the process table automatically when the parent process dies.

They do not slow down your machine and you can leave them there (they are just entries in the process table).

There is a maximum number of processes (you can check it with sysctl kern.maxproc) and zombie processes will reduce it (as they are counted).

If you reach this limit you will not be able to create new processes and you will be forced to reboot.

share|improve this answer
    
"Should be removed", but they're not always. Xcode is terrible about leaving zombie processes, and they aren't cleaned up even if Xcode dies / is quit / is killed. –  JRG-Developer Jan 12 '13 at 0:37
    
@JRG-Developer I agree but they are not a problem. They do no consume any resource. –  Matteo Jan 12 '13 at 6:18
    
Actually they are a problem when too many are created and fork can't launch any new process and you're forced to reboot. –  Adam Jan 15 '13 at 10:02
    
@Adam Yes, you are correct. They do not slow down your computer but they reserve resources. On my Mac (8GB of RAM) the limit is set to 2048. I updated my answer –  Matteo Jan 15 '13 at 15:23
add comment

Sadly, it appears that killing of zombies is all about killing the parent, and if the parent is /sbin/launchd, you can kill it only with rebooting.

I'm getting zombies from using Xcode, and stopping the simulator, and it's handing the zombies to my own personal /sbin/launchd, which didn't go away when I logged out.

ps -xo pid,ppid,stat,command will show you your processes, with their parent ID in the second column.

share|improve this answer
add comment

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.