I'm on a mac, doing:
rails server
I get:
2010-12-17 12:35:15] INFO WEBrick 1.3.1 [2010-12-17 12:35:15] INFO ruby 1.8.7 (2010-08-16) [i686-darwin10.4.0] [2010-12-17 12:35:15] WARN TCPServer Error: Address already in use - bind(2) Exiting
I know I can start one on a new port, but I want to kill this process.
One way to shut down a rogue server is with the kill command. For the PID output above, you could kill the corresponding stuck server using kill 42612 . And if that didn't work, you could try kill -9 42612 .
The best solution is to delete the file Server. pids outputs is the process id. You should kill -9 processid , replacing the process id with the 4 numbers that vim (or other editor) outputed.
Assuming you're looking to kill whatever is on port 3000 (which is what webrick normally uses), type this in your terminal to find out the PID of the process:
$ lsof -wni tcp:3000
Then, use the number in the PID column to kill the process:
$ kill -9 PID
kill -9 $(lsof -i tcp:3000 -t)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With