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/
I just now searched for this as I'm in a similar situation, and instead of kill -9 698
I tried sudo kill 428
where 428 was the pid of the process I'm trying to kill. It worked cleanly for me, in the absence of the hyphen '-' character. I hope it helps!
If you know the process name you can use:
killall Dock
If you don't you can open Activity Monitor and find it.
Given the path to your program, I assume you're currently running this under Xcode, and are probably at a debug breakpoint. Processes cannot be killed in this state because of the underlying implementation of breakpoints.
The first step would be to go to your Xcode process and stop debugging. If for some strange reason you have lost access to Xcode (perhaps Xcode has lost access to its gdb sub-process), then the solution is to kill the gdb process. More generally, the solution here is to kill the parent process. In your case this is PID 811 (the third column).
There is no need to use -9 in this case.
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.
Solution:
$ sudo kill -9 PID
Okay, sure enough Mac OS/X does give an error message for this case:
$ kill -9 196
-bash: kill: (196) - Operation not permitted
So, if you're not getting an error message, you somehow aren't getting the right PID.
I recently faced similar issue where the atom editor will not close. Neither was responding. Kill / kill -9 / force exit from Activity Monitor - didn't work. Finally had to restart my mac to close the app.
Some cases you might want to kill all the process running in a specific port. For example, if I am running a node app on 3000 port and I want to kill that and start a new one; then I found this command useful.
Find the process IDs running on TCP port 3000 and kill it
kill -9 `lsof -i TCP:3000 | awk '/LISTEN/{print $2}'`