tags:

views:

551

answers:

4

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
A: 

If you know the process name you can use:

killall Dock

If you don't you can open Activity Monitor and find it.

Garrett
I think it might be a bad idea to actually run that command. I suppose you could fairly easily just restart the dock, but I don't know if there would be any problems with that approach.
Chris Lutz
It was just an example of a process, I don't want him to kill his dock. I am assuming `killall` takes a different string compared to kill.
Garrett
+2  A: 

If you're trying to kill -9 it, you have the correct PID, and nothing haappens, 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.

Charlie Martin
Could be right but I seem to recall kill giving an error message if the process wasn't owned by the killer.
paxdiablo
God, that's one of those behaviors that is different from UNIX to UNIX. It's desirable *not* to have that error, because it's a covert channel; on the other hand it's a useful error message.
Charlie Martin
Which UNIX gives no error here? I've test BSD, Linux and Solaris and all give some form of the above error (EPERM).
Rob Napier
I don't know, although if I had to guess I'd guess Solaris with trusted extensions (the covert channel issue.) Also, notice that there are a couple blank lines after the kill. I wonder why?
Charlie Martin
A: 

If kill -9 isn't working, then neither will killall (or even killall -9 which would be more "intense"). Apparently the chromium process is stuck in a non-interruptible system call (i.e., in the kernel, not in userland) -- didn't think MacOSX had any of those left, but I guess there's always one more:-(. If that process has a controlling terminal you can probably background it and kill it while backgrounded; otherwise (or if the intense killing doesn't work even once the process is bakcgrounded) I'm out of ideas and I'm thinking you might have to reboot:-(.

Alex Martelli
A: 

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.

Rob Napier