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, is in use...

Any ideas?

  • Are you really on MacOS? Props, man.
    – Chris Lutz
    Jun 30, 2011 at 21:55
  • Please do not cross-post on multiple sites - decide which site is best for your question, and then write the question for that site's audience. Thanks.
    – nhinkle
    Jun 30, 2011 at 22:58

2 Answers 2


@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").

  • great now that I know what process is owning that, can I just kill it so that application can use that port to communicate with my NKE? Will ddi-tcp-1 just pick another port to use? and why do i only run into this problem on OS Mac 1.0.5?
    – reza
    Jul 5, 2011 at 15:14
  • It depends on what process is using the port, and how that process is managed -- if it's something controlled by launchd, it's probably configured to relaunch if it exits for any reason. What's the process using it? Here is an example of tracking down where a launchd item is being controlled and shutting it down. Jul 5, 2011 at 20:12

This is probably what you are looking for.

lsof | grep ":8888"

NOTE: Thanks @Gordon Davisson, I forgot about the alias I added which made the command above work for me.

alias lsof='sudo lsof -Pni4 | grep LISTEN'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.