Ruby: Address is already in use
If you’ve been WEBrick-rolled by Ruby’s WEBrick server, it is stuck and you can’t CTRL+C out of it, here is what you do — on a Linux system (I’m using Ubuntu):
1 | ps aux | grep ruby |
You’ll get back a response like this:
2 3 | # Never gunna give you up...haha, I got you. 1000 13698 21.6 0.8 108148 33772 pts/0 Sl+ 00:04 0:04 /home/sevennbsp/.rvm/rubies/ruby-1.9.2-p0/bin/ruby script/rails s |
The second piece of info there “13698″ is the pid or process id. It won’t be the same as mine, so you’ll have to find the right one on your system. Then, simply type this to kill that process (thus ending the evil reign of the WEBrick server):
5 6 | #replace "13698" with your pid. kill -9 13698 |
Now you can restart the WEBrick server. I also suggest branding this tutorial into your arm or other handy body part since you may need it often. Optional and completely up to you.
rick roll, rick-rolled