Address already in use errors – Find and kill process

Sometimes while working on rails applications and running them on different ports, I end up getting ‘Address already in use’ error when starting a new application. Usually you can look for the processes with ps and grep the ones you are looking for. But if you are unable to find the process with ps or top, try using lsof for finding open files.

lsof -i tcp:3000

This should list pids for applications using port 3000. Once you have the pid you can kill the process with kill command

kill -9 <PID> #where <PID> is the process id returned by lsof

Hope this helps!

Advertisements

One thought on “Address already in use errors – Find and kill process

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s