如何防止在Mac OSX 10.6下运行进程?

基本上,我想阻止一些系统进程的运行。 如果我强迫退出,他们只需重新启动。 我怎样才能防止他们启动/重新启动。

在你说我不应该混淆系统进程之前,我完全理解可能的后果。

这取决于如何启动和重新启动进程。 大多数系统进程由launchd处理; 如果这是你想要摆脱的进程的情况下,你需要find控制它的launchd项目(它将是/ System / Library / LaunchDaemons或/ Library / LaunchDaemons中的.plist文件之一)和使用sudo launchctl unload /path/to/launchd/item.plist禁用它。 如果你想使这个永久(即保持禁用,即使你重新启动),添加-w标志: sudo launchctl unload -w /path/to/launchd/item.plist 。 以下是查找和closureskrb5kdc进程的示例:

 # 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