How to restart launchd OS X without rebooting?

When I run Zotero/Firefox, they often crash and I am left with zombie processes; after this I cannot open new instances of Zotero or Firefox. I want to get rid of these zombie processes rather than rebooting, so for <pid> of the zombie process,

$ ps -p <pid> -o ppid=

gives me the <parent_pid> and

ps aux | awk -v PID=<parent_pid> '$2 == PID {print $0}'

tells me the parent process is /sbin/launchd for user crippledlambda.

Is there a way to restart this without killing my system?

sudo kill -1 <parent_pid>

does nothing. I've tried writing this in a script and running it with sudo:

for i in `launchctl list | grep launchd | awk -v PID=<parent_pid> '$1==PID { print $NF }'`; do `launchctl stop $i && launchctl start $i` ; done

and this obviously(?) leaves me with an unresponsive gray screen so I have to reboot anyway. Thanks in advance for your suggestions.


The proper way to stop and start launch daemons is launchctl unload.

For example:

You can stop a launch daemon service using the unload subcommand of launchctl.

$ sudo launchctl unload /System/Library/LaunchDaemons/<daemon name>.plist

To start a disabled or stopped launch daemon:

$ sudo launchctl load /System/Library/LaunchDaemons/<daemon name>.plist

★ Be careful with disabling launch daemons haphazardly - especially the official Apple ones; it can potentially make your system unbootable until you start in safe mode and manually re-enable them. You don't kill a launchctl like a normal process because it can potentially kill your system like you've experienced.

> more info on launchctl here. (Apple launchctl man page)


From the launchd man page:

You cannot invoke launchd directly.

Hence even if you could stop it you would not be able to start it so the answer is that there is no way.