Commands for MacOS which gives similar information as "lsappinfo" and "system_profiler SPApplicationsDataType" for other Mach-O binaries

Hello,

I am currently researching for ways to get the versions of all of the Mach-O executables and dylibs installed on my MacOS machine.

Based on my initial research, I am able to get the information of installed applications from commands like "lsappinfo" and "system_profiler SPApplicationsDataType".

However, the above commands only give me information about applications installed in my machine, not all the Mach-O binaries and dylibs.

I also saw otool -L output is not very reliable as some dylibs don't show the current version.

Are there any alternate commands I can try to get this information? Can this be achievable through any frameworks on MacOS? Any pointers will help me a lot.

I am currently researching for ways to get the versions of all of the Mach-O executables and dylibs

To what end?

Your ultimate goal here matters, because that affects what path you follow. For example, if you’re just messing around with shell scripts, then lsappinfo is a reasonable enough choice. However, if you’re trying to build a product that you ship to a wide range of users, you wouldn’t want to rely on lsappinfo because it’s output is intended to be read by humans, not by programs. OTOH, there are APIs that let you get similar information.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I am looking at performing this check on file system paths which I can consume as an input to my product. I understand lsappinfo is not scalable, can you please suggest which APIs can get me this similar information?

I have looked at using NSBundle, however, this would work if the CFBundleShortVersionString is added to the Info.plist. This would still not let me fetch the versions of dylibs linked to the executable.

Commands for MacOS which gives similar information as "lsappinfo" and "system_profiler SPApplicationsDataType" for other Mach-O binaries
 
 
Q