Last Updated: October 28, 2016
·
375
· novalagung

OSX - Find process by port and terminate it

lsof -i :<PORT>
kill -9 <PID>

for example, you have active tomcat process that run using default conf, and want to stop it.

# find the process 
lsof -i :8009
COMMAND   PID   FD   TYPE DEVICE              SIZE/OFF   NODE   NAME
java    10373   66u  IPv6 0x574a054ac035b4d1  0t0        TCP    *:8009 (LISTEN)

# terminate the process
kill -9 10373

source : How to find the process that is running on a given port in OSX