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
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.
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}'`
If you know the process name you can use:
killall Dock
If you don't you can open Activity Monitor and find it.
Do you can list the process using a port with command lsof, for example:
lsof -i tcp:PORT_NUMBER_HERE
Replace the word PORT_NUMBER_HERE to the port number that you are using, then a the process running on the port will be listed. Then you have just to kill the process ID founded like this:
kill PID_NUMBER
Where PID_NUMBER is the process ID running on the port.
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:-(.
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!
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.
I have experienced that if kill -9 PID doesn't work and you own the process, you can use kill -s kill PID which is kind of surprising as the man page says you can kill -signal_number PID.
in the spotlight, search for Activity Monitor. You can force fully remove any application from here.
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.
Related
Our teachers told us to experiment with the terminal and kill -9 -1
To my understanding, on UNIX based OS, the first process charged is Init with PID -1 from which the other processes will spawn. I assumed that you couldn't kill it as it is charged in a secured part of memory.
On a VM running LinuxMint, the command would would cause the session to close itself. On MacOS, it would close/crahs(?) all applications.
On some other people laptops running different distribution of Linux the command would be denied which was the behaviour I would have expected in any OS.
So I am confused by the behaviour of the command.
What should be the normal result? Or is it bound to each OS implementation?
Thanks.
The general behaviour, from Kill MAN page:
If pid equals -1, then sig is sent to every process for which the calling process has permission to send signals, except for process 1 (init)
So, "kill -9 -1" will kill all processes it can.
I am unable to kill a process using kill command in Linux. And i cannot use Kill -9 to kill the process. can any one please help.
It state is most probably D then, the only state in which kill -9 won't work. Most of the time the only fix is remount the filesystem or reboot.
You can kill the running processes in linux by using kill -9 processId provided that you have right privileges to stop the process. Provide more information if you need more help.
I have a node.js application that uses some socket ports. Sometimes, when I exit the application with Ctrl + C, some kind of node process is left running, still allocating the socket ports. Thus, I cannot restart my application, since it fails to open those ports. When I look the situation with ps, I get the following response:
$ ps
PID TTY TIME CMD
40454 ttys000 0:00.11 -bash
41643 ttys001 0:00.00 (node)
41741 ttys001 0:00.00 (node)
Trying kill -9 41643 doesn't kill the process. Is it a some kind of unkillable zombie? How can I get rid of those (node)-things blocking my tcp ports?
I'm not a MAC user, but here is what I use to kill all the available node processes (under linux):
sudo killall -9 node
On macOS, it's simply:
sudo killall -9 node
For a lot of the times, sudo is overkill, but in your case, it looks like you might want to try sudo.
I'm developing a Sinatra application and I'm using "rackup" to start Webrick. What should I do to stop it? Now I'm using Ctrl+Z and it seems like it stops. However when I try to start it again it will say that the port is already bound.
I tried it with many ports and each time it started, stopped and then said it was in use when I restarted it again.
How do I solve it?
Ctrl+Z will just "pause" the process, not terminate / kill it.
To truly kill it, find it in the process table and do kill -9 [PID]
like:
ps auxwww | grep ruby
slivu 16244 0.0 0.5 2551140 61220 s020 R+ 1:18AM 0:10.70 ruby app.rb
the second column(16244) is the PID.
The other way is to "catch" the INT signal with Ruby and exit the app explicitly.
in your app:
Signal.trap 'INT' do
Process.kill 9, Process.pid
end
Extending on slivu's reply,
use CTRL+C to kill the process if you are still in the same terminal.
If you are launching it in the background, or want to kill from a different terminal, use
ps aux | grep [r]ackup | awk '{print $2}' | xargs sudo kill -9
I have an instance of lighttpd running. When I do "ps -axc" the process is listed as
"614 ?? 0:00.15 lighttpd"
But when I do "killall lighttpd" I get
No matching processes belonging to you were found
I'm on Mac OS X 10.5.6. Is there something I'm missing?
As per the other response, if it's not your process, prepend sudo if you're an administrator. If not, you may be out of luck.
Also, try sudo killall -9 lighttpd which sends the specific signal KILL instead of TERM.
Just to be sure you can also try sudo kill -9 614 using the PID.
Is the task written in the ps aux list in brackets? If so, it is a zombie, it is waiting some I/O task, which probably never completes. You can't kill it as far as I know.
Does it belong to you ? If you do
ps aux | grep lighttpd
that will give you the user id associated with that process (I'm guessing it's chowned to another user)
It works: killall -u root -c lighttpd
Try
sudo kill -9 `pgrep lighttpd`