Sometimes I need to lookup process that hold a port open. On Linux this is quite easy but on Mac I was struggling to find a proper way. Here is the netstat variant you can use on Mac:
netstat -anv -p tcp | grep tcp4 | grep "8080"
Replace the 8080 with the wanted port.
You will see a line like this:
tcp4 0 0 127.0.0.1.8080 *.* LISTEN 131072 131072 54876 0 00000 00000006 00000000002d50b2 00000000 00000800 2 0 000001
The 54876
is the process id. So you can send a kill 54876
.