If you want to know which version of an application is installed on a Mac OS X system you can do so from within the GUI using the About option. E.g., in the Safari web browser you can click on Safari and select About Safari. You can also determine the version of applications installed on an OS X system by clicking on the Apple icon in the upper, left-hand corner of the screen then selecting About This Mac, then More Info, then System Report, then Software, and then clicking on Applications beneath Software as shown at Determining the version of the OS and applications under OS X.
However, if you wish to determine the version of an application
from a command line interface (CLI), aka a shell prompt, which
you can get using the Terminal application found
in Applications/Utilities you can use the command
system_profiler SPApplicationsDataType
. If you pipe the
output of the command to the more
command you can page
through the list that is output by hitting the space bar when the colon
(:
) prompt is displayed.
$ system_profiler SPApplicationsDataType | more Applications: Microsoft Lync: Version: 14.2.1 Last Modified: 10/2/15 8:52 PM Kind: Intel 64-Bit (Intel): No App Store: No Get Info String: 14.2.1 (150923), © 2010 Microsoft Corporation. All rights reserved. Location: /Applications/Microsoft Lync.app Junos Pulse: Version: 5.0 Last Modified: 4/17/14 4:27 PM Kind: Intel 64-Bit (Intel): No App Store: No Location: /Applications/Junos Pulse.app Microsoft Database Utility: Version: 13.1.6 :
If you are interested in the version of a particular program, such as Safari,
you can use the grep
utility to search for the application name
followed by a colon and then after grep display the two lines that appear after
it finds a match. E.g.:
$ system_profiler SPApplicationsDataType | grep -A 2 "Safari:" Safari: Version: 6.2.8
If you just want to see the version number as output, you can pipe the
output of the above command to the cut
utility, instructing
it to display the string that starts in column 16 of the line that
contains "Version" as shown below. The -c 16-
parameter
instructs cut to display characters from column 16 to the end of the
line.
$ system_profiler SPApplicationsDataType | grep -A 2 "Safari:" | grep "Version:" | cut -c 16- 6.2.8 $ system_profiler SPApplicationsDataType | grep -A 2 "Junos Pulse:" | grep "Version:" | cut -c 16- 5.0