I'm trying to see what happens when I try to kill the
kernel_task process. Since
kill -9 pid is the command to force quit a process, and
kernel_task's pid is 0, I simply ran
kill -9 0.
Instead of getting
Permission Denied or a
Operation not permitted when killing a root process, you simply get this:
Last login: Thu Jun 18 16:55:10 on ttys005 MacBook-Air:~ james$ kill -9 0 [Process completed]
… which is weird because trying to kill
launchd (one level below
kernel_task) gives you this:
-bash: kill: (1) - Operation not permitted
and all other root processes.
Why the heck does it just terminate the process that called the command, instead of sending
Operation not permitted, like all the other root processes?
Bonus points if you can tell me the answer to this question:
If you create a script that tries to kill
kernel_task (and ignores
SIGTERM), running it will output
Killed: 9 and return to bash. Why does it put that into stdout when it kills it? Why not something more descriptive?