Detecting what frameworks application is using

325 views Asked by At

I am looking at way of detecting what frameworks application is using.

For example, say some XYZ application uses carbon framework and cocoa framework, then my program should be able to detect that this XYZ application makes use of carbon framework and cocoa framework.

Any help would be highly appreciated.

Thanks, Rahul

2

There are 2 answers

0
AudioBubble On BEST ANSWER

The easiest way is to run otool -L on the application binary. For instance,

$ otool -L /Applications/Twitter.app/Contents/MacOS/Twitter | grep Frameworks
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
    /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.6.2)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 37594.0.0)
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 152.0.0)
    /System/Library/Frameworks/QTKit.framework/Versions/A/QTKit (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 533.16.0)
    /System/Library/Frameworks/CoreLocation.framework/Versions/A/CoreLocation (compatibility version 1.0.0, current version 12.0.0)
    @executable_path/../Frameworks/Growl.framework/Versions/A/Growl (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.29.0)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.29.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1038.32.0)

If you cannot run otool for some reason, you can always read its source code and use it according to its licence.

0
Dave DeLong On

You could parse the output to lsof, or you could go browse the sources of lsof and copy the relevant code into your own app.