MacOS what process is using port 8888

How can I tell which process is using port 8888? I have an NKE and my process is needing to connect to it. Every now and then I get bind socket error, 127.0.0.1:8888 is in use...

Any ideas?


Solution 1:

@Somantra's answer is close, but won't quite work. Try:

sudo lsof -i:8888

sudo may be needed so lsof can see processes not owned by you; also, grepping lsof's output will fail unless you search for the service name associated with port 8888 (it's "ddi-tcp-1").