MacOS – How to determine what process has opened a network connection

internetmacosNetwork

Whereas on Windows it's possible to use Netstat -b, which tells you what connections are open and what program has each one open, on the Mac it seems that Netstat does not allow this.

Is there another way to get this information if Netstat isn't the tool for that job?

Best Answer

> lsof -i :58199
COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Transmiss 304 Fyodor    8u  IPv4 0x2fbc34fe135e3895      0t0  UDP *:58199

lsof = list open files. See manual for more details.

/usr/sbin/lsof

You can see with "ps -ef" more info about the PID "lsof" gave you.