How to kill a Rails development server by force

Posted Over 1 year ago. Visible to the public.

Sometimes, the rails dev server doesn't terminate properly. This can for example happen when the dev server runs in a RubyMine terminal.

When this happens, the old dev server blocks port 3000, so when you try to start a new server, you get the error:

Address already in use - bind(2) for "127.0.0.1" port 3000 (Errno::EADDRINUSE)

You can terminate such a dev server with this command:

lsof -t -i :3000 -s TCP:LISTEN | xargs kill -9

It might be worth it to add this to your bash aliases.

Klaus Weidinger
Last edit
6 months ago
Niklas Hasselmeyer
Keywords
quit
License
Source code in this card is licensed under the MIT License.
Posted by Klaus Weidinger to makandra dev (2023-01-30 14:16)