Error - Address/Port Already in Use

Posted: | Last updated: | less than 1 minute read

Developers get this error when they are trying to run the a service twice on same server. Like are trying running tomcat / Apache or jekyll server twice on the same server.

For example, running jekyll serve

jekyll 3.1.6 | Error:  Ad dress already in use - bind(2) for 127.0.0.1:4000

This is because your jekyll process somehow wasn’t killed properly, and then you tried to run another process using the same port.

To solve, kill the process that is using the port (eg 4000):

lsof -i :4000
kill -9 <PID>

Above solution is applicable for anyother server as well!