lsof is not working for me on Mac OS X 10.13 – gives error, I’m trying to find process accessing a specific IP address

Posted on

Problem :

lsof isn’t working for me. I’m trying to use instructions in posts such as How do I find out which program and process ID accesses a given IP address in macOS? to find which process is accessing a specific IP address. But on OSX 10.13 it gives me:

% sudo lsof -i 1.2.3.4

Password:

lsof: unknown protocol name (1.2.3.4) in: -i 1.2.3.4 lsof 4.91 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man usage: [-?abhlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-f[cgG]] [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+|-M] [-o [o]] [-p s] [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [–] [names] Use the “-h” option to get more help information.

what am I doing wrong?

Solution :

According to the manual page for lsof(8), the syntax should be:

sudo lsof -i @1.2.3.4

(Note the “@”.)

It’s possible the original Answer you were going off of had a typo, or perhaps the syntax for lsof(8) has changed.

Leave a Reply

Your email address will not be published.