For *nix we can use

  netstat -anp

specifically the -p option. This is not supported on macOS. I also tried -b and -o which do not work. So how is this done on macOS?


Try using the -v option for verbose output. That will give, well, verbose results so you can filter a bit with -p and then maybe pipe to grep for your port number. Something like this to find the process using TCP protocol on port 80:

netstat -anv -p tcp | grep "*.80"

Here's a helpful resource with other options: https://www.btaz.com/mac-os-x/find-the-process-listening-to-port-on-mac-os-x/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .