how to kill a process in a port


Step 1

we need to be able to see wich process are runin on the port we want to freem, we need to execute the next comand in our terminal:

lsof -i :3000

previous comand will show somthing like this:

ruby 123456 diego 10u IPv4 1234 0t0 TCP 127.0.0.1:3000 (LISTEN)

step 2

Wee need to use the PID (in this example 123456) and kill the process:

kill -9 123456

Step 3

Now the port should be free, if we were to run a rails project we could do it now by runing

rails s

and now should not there be any conflicting port.