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 (
Using this command you can kill the server:
ps aux|grep rails
If you are on windows machine follow these steps.
c:/project/
cd tmp
c:/project/tmp
cd pids
c:/project/tmp/pids
dir
There you will a file called server.pid
delete it.
c:/project/tmp/pid> del *.pid
Thats it.
EDIT: Please refer this
To kill process on a specific port, you can try this
npx kill-port [port-number]
One line solution:
kill -9 $(ps aux | grep 'rails s' | awk {'print$2'}); rails s
For anyone stumbling across this question that is not on a Mac: assuming you know that your server is running on port 3000, you can do this in one shot by executing the following:
fuser -k 3000/tcp
But as Toby has mentioned, the implementation of fuser in Mac OS is rather primitive and this command will not work on mac.
All the answers above are really good but I needed a way to type as little as possible in the terminal so I created a gem for that. You can install the gem only once and run the command 'shutup' every time you wanna kill the Rails process (while being in the current folder).
gem install shutup
then go in the current folder of your rails project and run
shutup
# this will kill the Rails process currently running
You can use the command 'shutup' every time you want
DICLAIMER: I am the creator of this gem
NOTE: if you are using rvm install the gem globally
rvm @global do gem install shutup