tinyapps.org / blog


Find the product version and build information of an OS X installer #

The hard way:

The easy way (thanks to Johann N. Löfflmann):

# Find the OS X version and build information of an OS X installer

# see Johann N. Löfflmann's blog post for more information:
# http://loefflmann.blogspot.com/2015/03/finding-os-x-version-and-build-in-install-os-x-app.html

# Assumes installer is in default location (/Applications);
# change path in first hdiutil command if it is located elsewhere.

# Tested on OS X 10.7 - 10.11 installers

APPNAME="Install OS X Yosemite.app" # Change to desired version
DEBUG="/dev/null"

hdiutil attach "/Applications/$APPNAME/Contents/SharedSupport/InstallESD.dmg" -noverify -nobrowse -mountpoint /Volumes/InstallESD.$$ > $DEBUG

hdiutil attach "/Volumes/InstallESD.$$/BaseSystem.dmg" -noverify -nobrowse -mountpoint /Volumes/BaseSystem.$$ > $DEBUG

XMLCONTENT=$(<"/Volumes/BaseSystem.$$/System/Library/CoreServices/SystemVersion.plist")
if [[ "$XMLCONTENT" =~ \<key\>ProductVersion\</key\>[[:space:]]*\<string\>([0-9\.]+)\</string\> ]]; then
    printf "ProductVersion: %s\n" ${BASH_REMATCH[1]}
fi

if [[ "$XMLCONTENT" =~ \<key\>ProductBuildVersion\</key\>[[:space:]]*\<string\>([0-9A-Z]+)\</string\> ]]; then
    printf "BuildVersion:   %s\n" ${BASH_REMATCH[1]}
fi

hdiutil detach "/Volumes/BaseSystem.$$" > $DEBUG

hdiutil detach "/Volumes/InstallESD.$$" > $DEBUG

UPDATE: Johann has an updated version of his script on GitHub: osxapp_vers.

/mac | Jul 01, 2016


Subscribe or visit the archives