Created
July 26, 2017 02:19
-
-
Save carlashley/1b76d6988a0283b9e0ff36a7f1ecb355 to your computer and use it in GitHub Desktop.
Gets macOS X Installer app version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Shamelessly stolen from https://loefflmann.blogspot.com.au/2015/03/finding-os-x-version-and-build-in-install-os-x-app.html | |
# Provide the path to the installer file from the command line. | |
if [[ ! -z $1 ]]; then | |
os_installer_path="$1" | |
echo "Attaching ${1}" | |
hdiutil attach "${os_installer_path}/Contents/SharedSupport/InstallESD.dmg" -quiet -noverify -nobrowse -mountpoint /Volumes/InstallESD.$$ | |
hdiutil attach "/Volumes/InstallESD.$$/BaseSystem.dmg" -quiet -noverify -nobrowse -mountpoint /Volumes/BaseSystem.$$ | |
os_ver=$(defaults read "/Volumes/BaseSystem.$$/System/Library/CoreServices/SystemVersion.plist" ProductVersion) | |
build=$(defaults read "/Volumes/BaseSystem.$$/System/Library/CoreServices/SystemVersion.plist" ProductBuildVersion) | |
echo "OS Version: ${os_ver} (${build})" | |
echo "Detaching ${1}" | |
hdiutil detach "/Volumes/BaseSystem.$$" -quiet | |
hdiutil detach "/Volumes/InstallESD.$$" -quiet | |
else | |
echo "Please specify path to macOS Install application." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment