Last Updated: February 25, 2016
·
446
· cayley

Finding process by open port on OSX

Sometimes when node dies on the CLI it doesn't actually kill the process. Attempting to run it again results in an Error: listen EADDRINUSEerror.

To find the id of the rouge processes on OSX, the line found http://juretta.com/log/2007/08/08/list_open_ports_on_your_machine_mac_os_x_/ is what you need:

sudo lsof -i -P | grep -i "listen"

Then just kill the pid of the offending process and away you go.