Search code examples
xcodemacosotool

Determining OS X SDK and Deployment Target versions from Framework


Fairly straightforward question - if I have a .framework file, is there a command/tool that can be used to determine the SDK and Deployment Target versions used to create the framework?

Similarly, can this be performed on the application binary stored inside a .app file? I'm looking to automate a script that will go search a list of previously-built apps/frameworks, without having the original .xcodeproj files, and determining their high/low supported OS versions.


Solution

  • To find out the SDK and Deployment Target of some binary you should explore the LC_VERSION_MIN_MACOSX load command. Use otool -l <some_binary> to see load commands.
    Example:

    $otool -l my_binary
    ...
    Load command 9
          cmd LC_VERSION_MIN_MACOSX
      cmdsize 16
      version 10.7
          sdk 10.8
    ...
    
    $otool -l /System/Library/Frameworks/CoreWLAN.framework/CoreWLAN 
    ...
    Load command 8
          cmd LC_VERSION_MIN_MACOSX
      cmdsize 16
      version 10.8
          sdk 10.8
    ...
    

    Example with piping to grep:

    otool -l my_binary | grep -A 3 LC_VERSION_MIN_MACOSX