The script called osxapp_vers finds the product name, the complete product version, and the build version in an Install*OS X*.app package, in an Install macOS*.app package or in a mounted CD/DVD image called Mac OS X Install * and prints the info out the way macOS's /usr/bin/sw_vers does for an installed macOS product.
The idea for this is described on my blog.
- At least Mac OS X 10.6.8 (Snow Leopard) in order to run the bash script, older releases haven't been tested.
Install macOS 27 Golden Gate.apporInstall macOS Tahoe.apporInstall macOS Sequoia.apporInstall macOS Sonoma.apporInstall macOS Ventura.apporInstall macOS Monterey.apporInstall macOS Big Sur.apporInstall macOS Catalina.apporInstall macOS Mojave.apporInstall macOS High Sierra.apporInstall macOS Sierra.apporInstall OS X El Capitan.apporInstall OS X Yosemite.apporInstall OS X Mavericks.apporInstall OS X Mountain Lion.apporInstall Mac OS X Lion.appfrom the Apple App Store (1st public version or any update release) or- bootable macOS install media created by Apple's
createinstallmedia- See also How to create a bootable installer for macOS or
- a mounted Mac OS X Install CD/DVD image such as
Mac OS X Install DVDorMac OS X Install CDorMac OS X Install Disk
Tip
The script also works with bootable macOS install media created and patched by the OpenCore Legacy Patcher.
Tip
Starting with macOS Tahoe, you will no longer be able to download the installer directly from the App Store. Use softwareupdate instead.
softwareupdate --fetch-full-installer --full-installer-version 26.0
Download the osxapp_vers file from GitHub to a folder of your choice.
% curl -Ls https://bit.ly/osxapp_vers > osxapp_versSet execute permissions.
% chmod +x ./osxapp_versIn order to bypass a check that prevents the script from investigating an unknown macOS release, you can set the NOCHECK environment variable.
% export NOCHECK=1In order to see details of the mount actions and additional messages, you can enable debug output by exporting the DEBUG environment variable. Usually there is no need to do that.
% export DEBUG=/dev/stdoutIf you want to disable debug mode again, enter
% export DEBUG=% ./osxapp_vers% curl -Ls https://bit.ly/osxapp_vers | bashBy default, if you don't specify any program parameters, the script reads all Install*OS X*.app and Install macOS *.app folders known to Spotlight and all /Volumes/Mac OS X Install * volumes, and prints out the product name, product version and build version for the macOS release that each of those installers contains.
Example output from runs without any program parameters:
/Volumes/Mac OS X Install Disc 1:
ProductName: Mac OS X
ProductVersion: 10.3
BuildVersion: 7B85
/Volumes/Mac OS X Install DVD:
ProductName: Mac OS X
ProductVersion: 10.4
BuildVersion: 8A428
/Volumes/Mac OS X Install DVD:
ProductName: Mac OS X
ProductVersion: 10.5
BuildVersion: 9A581
/Volumes/Mac OS X Install DVD:
ProductName: Mac OS X
ProductVersion: 10.6
BuildVersion: 10A432
/Applications/Install Mac OS X Lion.app:
ProductName: Mac OS X
ProductVersion: 10.7.5
BuildVersion: 11G63
/Applications/Install OS X Mountain Lion.app:
ProductName: Mac OS X
ProductVersion: 10.8.5
BuildVersion: 12F45
/Applications/Install OS X Mavericks.app:
ProductName: Mac OS X
ProductVersion: 10.9.4
BuildVersion: 13E28
/Applications/Install OS X Yosemite.app:
ProductName: Mac OS X
ProductVersion: 10.10.2
BuildVersion: 14C109
/Applications/Install OS X El Capitan.app:
ProductName: Mac OS X
ProductVersion: 10.11.5
BuildVersion: 15F34
/Applications/Install macOS Sierra.app:
ProductName: Mac OS X
ProductVersion: 10.12
BuildVersion: 16A323
/Applications/Install macOS High Sierra.app:
ProductName: Mac OS X
ProductVersion: 10.13
BuildVersion: 17A365
/Applications/Install macOS Mojave.app:
ProductName: Mac OS X
ProductVersion: 10.14
BuildVersion: 18A391
/Applications/Install macOS Catalina.app:
ProductName: Mac OS X
ProductVersion: 10.15
BuildVersion: 19A583
/Applications/Install macOS Big Sur.app:
ProductName: macOS
ProductVersion: 11.1
BuildVersion: 20C69
/Applications/Install macOS Monterey.app:
ProductName: macOS
ProductVersion: 12.0.1
BuildVersion: 21A559
/Applications/Install macOS Ventura.app:
ProductName: macOS
ProductVersion: 13.0
BuildVersion: 22A380
/Applications/Install macOS Sonoma.app:
ProductName: macOS
ProductVersion: 14.0
BuildVersion: 23A344
/Applications/Install macOS Sequoia.app:
ProductName: macOS
ProductVersion: 15.0
BuildVersion: 24A335
/Applications/Install macOS Tahoe.app:
ProductName: macOS
ProductVersion: 26.0
BuildVersion: 25A354
/Applications/Install macOS 27 Golden Gate.app:
ProductName: macOS
ProductVersion: 27.0
BuildVersion: 26A428If you specify program parameters, the script prints out the product name, product version and build version for each installer app that you have specified.
% ./osxapp_vers '/Applications/Install OS X Mavericks.app'
/Applications/Install OS X Mavericks.app:
ProductName: Mac OS X
ProductVersion: 10.9.4
BuildVersion: 13E28If you have created a bootable macOS install media with createinstallmedia (that command-line tool is provided by Apple as part of the OS X installer starting with Mavericks), you can also find out which macOS version is on the install media by specifying the path to the .app folder.
% ./osxapp_vers '/Volumes/Install OS X Mavericks/Install OS X Mavericks.app/'
/Volumes/Install OS X Mavericks/Install OS X Mavericks.app/:
ProductName: Mac OS X
ProductVersion: 10.9.2
BuildVersion: 13C64That approach also works for macOS beta releases. The name of a beta installer (Install macOS Tahoe Beta.app) is not part of the list of known releases, therefore the NOCHECK environment variable is required in that case.
% NOCHECK=1 ./osxapp_vers /Volumes/Install\ macOS\ Tahoe\ Beta/Install\ macOS\ Tahoe\ Beta.app
/Volumes/Install macOS Tahoe Beta/Install macOS Tahoe Beta.app:
ProductName: macOS
ProductVersion: 26.0
BuildVersion: 25A5316iInformational and error messages go to stderr, only the header line and the product name, product version and build version go to stdout. That way ./osxapp_vers > versions.txt contains the version info only. The script exits with 0 if every installer that has been found could be read, and with 1 if at least one of them could not be read.
% ./osxapp_vers '/Applications/Install macOS Tahoe.app' 2>/dev/null
/Applications/Install macOS Tahoe.app:
ProductName: macOS
ProductVersion: 26.7
BuildVersion: 25G229To get the version of the script, simply enter
% grep osxapp_vers ./osxapp_vers
# osxapp_vers 1.18The license that the project is offered under is the Apache 2.0 license.