lsof is so slow on Mojave. Any alternatives or improvements?

Regarding https://discussions.apple.com/thread/250297792


lsof also slow for me in Mojave.


At first I thought it was a problem with macOS 10.14. But I think the issue is with lsof itself.


The newer version of lsof included with Catalina, 4.91, it is MUCH faster.


Mojave comes with lsof 4.89

Catalina comes with lsof 4.9.1

(also, for reference, High Sierra comes with lsof 4.89)


Here are the 2 lsof versions run on same machine 10.14.6 (18G3020),


4.89

time lsof | wc -l
    4472

real	0m14.250s
user	0m0.101s
sys	0m14.086s


4.9.1

time /usr/local/lsof4.9.1 | wc -l
    4474

real	0m0.197s
user	0m0.075s
sys	0m0.114s



I will still default to 4.89 as that is what came with Mojave, but I have 4.91 unhand for troubleshooting.


Hope this helps some peeps.


Bernuli

Posted on Feb 23, 2020 11:09 AM

Reply

Similar questions

5 replies

Feb 23, 2020 11:26 AM in response to bernuli

I tried Homebrew lsof 4.93.2

brew install lsof

and it ran slower than then the Mojave lsof

time /usr/local/opt/lsof/bin/lsof | wc -l # home brew installed 4.92.2
   10557

real	0m50.151s
user	0m0.254s
sys	0m26.017s


time lsof | wc -l  # native Mojave lsof
   10551

real	0m39.919s
user	0m0.225s
sys	0m24.049s


So I would conclude it is not the newer version, but something Apple did to their version, such as taking advantage of macOS kernel features that the older Mojave version did not, and that the Open Source version does not either.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

lsof is so slow on Mojave. Any alternatives or improvements?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.