How can I prevent a process from running under Mac OSX 10.6?
Basically, there are some system processes that I want to prevent from running. If I force quit them, they simply restart. How can I prevent them from starting/relaunching.
Before you say that I shouldn't mess with system processes: I fully understand the possible consequences.
Solution 1:
It depends on how the process is being started and restarted. Most system processes are handled by launchd; if this is the case with the process you want to get rid of, you need to find the launchd item that's controlling it (it'll be one of the .plist files in /System/Library/LaunchDaemons or /Library/LaunchDaemons) and disable it with sudo launchctl unload /path/to/launchd/item.plist
. If you want to make this permanent (i.e. stay disabled even when you reboot), add the -w flag: sudo launchctl unload -w /path/to/launchd/item.plist
. Here's an example of finding and shutting down the krb5kdc process:
# First, find the pid of the running process:
$ ps -axwww | grep [k]rb5kdc
3143 ?? 0:33.38 /usr/sbin/krb5kdc -n
# Now find label of the the launchd item controlling it
$ sudo launchctl list | grep 3143
3143 - edu.mit.Kerberos.krb5kdc
# Now find the .plist file that defines that item label:
$ grep -l edu.mit.Kerberos.krb5kdc /Library/LaunchDaemons/* /System/Library/LaunchDaemons/*
/System/Library/LaunchDaemons/edu.mit.Kerberos.krb5kdc.plist
# Finally, disable the launchd item (permanently):
$ sudo launchctl unload -w /System/Library/LaunchDaemons/edu.mit.Kerberos.krb5kdc.plist