Check build environment from Info.plist

After an application or library is released, when bugs need to be corrected, the build environment of that time may be required. Usually, using the latest version of the environment at the time of the correction is not a problem. However, the build environment of that time may be necessary for the following reasons, for example.

  • You want to fix only specific bugs with as narrow a scope of impact as possible.
  • Cannot use the latest version of Xcode due to system requirements reasons.
  • There is a problem with library dependencies.
  • Requires an Xcode version that is officially supported by third-party compilers integrated with Xcode.

I try to keep a record of the build environment by putting written documentation of the build environment in the code repository or with the release notes and handouts.

This article explains how to find out if you did not keep records.

TOC

What changes with different versions of Xcode

Different major versions of Xcode have different versions of the cross-platform SDKs that come with Xcode. Cross-platform SDKs are SDKs for using frameworks provided by the OS, such as UIKit and AppKit.

Different versions of the cross-platform SDK used at build time may cause the app to behave differently even on the same OS. In my experience in the past, the design and margins of NSTableView table headers have changed, and when decoded by NSBitmapImageRep, the vertical bitmap storage was upside down (this was on macOS 10.5 or so). When running on macOS 11, the OS version that could be obtained was sometimes 10.16 when linked with an older SDK and 11.0 with a newer SDK.

The Xcode release notes often mention these, but sometimes they do not.

About the Info.plist file

On Apple Platforms such as macOS and iOS, apps are in application packages with the extension .app. Also, frameworks are in a bundle format with a .framework extension.

These bundles contain an Info.plist file, which is built at development time with the version number and other information. It contains information entered by the developer, but there is also information added by the compiler and linker. Among the information added automatically is information about the build environment.

Information about the build environment

Here is the information about the build environment that will be added to the Info.plist file. The ones I am anticipating are marked with “?” is added.

KeyDescription
BuildMachineOSBuildOS build number at build time
DTCompilercom.apple.compilers.llvm.clang.1_0
DTPlatformBuildToolchain version of platform SDK?
DTPlatformNamePlatform Name of Platform SDK
DTPlatformVersionTarget Version of Platform SDK
DTSDKBuildPlatform SDK build number
DTSDKNameName of Platform SDK
DTXcodeXcode Version
DTXcodeBuildXcode build number
Information about the build environment

macOS Application Example

Here is an example of a macOS app I built. The following was written to Info.plist.

キー説明
BuildMachineOSBuild21G217
DTCompilercom.apple.compilers.llvm.clang.1_0
DTPlatformBuild14A400
DTPlatformNamemacosx
DTPlatformVersion12.3
DTSDKBuild21E226
DTSDKNamemacosx12.3
DTXcode1401
DTXcodeBuild14A400
Example of macOS application

The environment in which this application was built is macOS 12.6.1 + Xcode 14.0.1.

Wikipedia has a list of OS build numbers, and if you check, 21G217 is listed as macOS 12.6.1. Also, in DTXcode, the top two digits are the major version, the third digit is the minor version, and the fourth digit is the revision, so 1401 is 14.0.1.

iOS App Example

Here is an example of an iOS app I built. The following was written to Info.plist.

キー説明
BuildMachineOSBuild21G217
DTCompilercom.apple.compilers.llvm.clang.1_0
DTPlatformBuild20A360
DTPlatformNameiphonesimulator
DTPlatformVersion16.0
DTSDKBuild20A360
DTSDKNameiphonesimulator16.0
DTXcode1401
DTXcodeBuild14A400
iOS App Example

The environment in which this application was built is macOS 12.6.1 + Xcode 14.0.1.

Wikipedia has a list of OS build numbers, and if you check, 21G217 is listed as macOS 12.6.1. Also, in DTXcode, the top two digits are the major version, the third digit is the minor version, and the fourth digit is the revision, so 1401 is 14.0.1.

Also, as the DTPlatformName is iphonesimulator, it is built for the iOS simulator. Also, the DTPlatformVersion of the SDK is 16.0, indicating that the iOS 16 SDK is used.

Let's share this post !

Author of this article

Akira Hayashiのアバター Akira Hayashi Representative, Software Engineer

I am an application developer loves programming. This blog is a tech blog, its articles are learning notes. In my work, I mainly focus on desktop and mobile application development, but I also write technical books and teach seminars. The websites of my work and books are here -> RK Kaihatsu.

TOC