For *nix we can use
-p option. This is not supported on
macOS. I also tried
-o which do not work. So how is this done on
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
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/