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

I need to get a list of files that are currently open in a tree. losf +D does the trick but it takes 30 seconds to scan about 1000 files even with the -n switch. linux takes under 0.2 seconds.


Anything I can do to improve this, or alternative to generate a list of open files in a tree?

MacBook Pro 15", macOS 10.14

Posted on Apr 11, 2019 6:06 AM

Reply
2 replies

Apr 11, 2019 6:34 AM in response to bluesofa

Do you need to perform a full directory descent (+D), rather than no descent (+d)? If so, would that improve response time for your particular directory?


Although you can compare lsof elapsed wall-time between Linux and Mojave, and that for instance, Ubuntu 18.04.1 LTS is running the same version (4.89) of lsof, that is where the similarities end with respect to operating system implementations. There is far less vendor induced overhead in Linux.

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.