如何在MacOS中终止进程? [英] How to kill a process in MacOS?
本文介绍了如何在MacOS中终止进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了kill -9 698
,但是该过程并未终止.
I tried kill -9 698
but the process did not die.
$ ps -ef | grep chromium
502 698 811 0 0:01.24 ?? 0:07.28 /Users/lucius/chromium/src/xcodebuild/Debug/Chromium.app/Contents/MacOS/Chromium
502 854 732 0 0:00.00 ttys001 0:00.00 grep chromium
$ kill -9 698
$ ps -ef | grep chromium
502 698 811 0 0:01.24 ?? 0:07.28 /Users/lucius/chromium/src/xcodebuild/Debug/Chromium.app/Contents/MacOS/Chromium
502 854 732 0 0:00.00 ttys001 0:00.00 grep chromium
推荐答案
如果您要杀死-9,则您具有正确的PID,并且没有任何反应,则您无权杀死该进程.
If you're trying to kill -9 it, you have the correct PID, and nothing happens, then you don't have permissions to kill the process.
解决方案:
$ sudo kill -9 PID
好的,对于这种情况,请确保足够的Mac OS/X确实会给出错误消息:
Okay, sure enough Mac OS/X does give an error message for this case:
$ kill -9 196
-bash: kill: (196) - Operation not permitted
因此,如果您没有收到错误消息,则可能是由于某种原因而没有获得正确的PID.
So, if you're not getting an error message, you somehow aren't getting the right PID.
这篇关于如何在MacOS中终止进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文