I use ssh client to login into my Mac Min server without GUI. How can I tell what version of Mac OS X operating system am I using command prompt? How do I find out Mac OS X version from Terminal app bash shell?

On Apple macOS/OS X you need to use the following command to find out operating system version:
  1. system_profiler command – Show Apple hardware and software configuration.
  2. sw_vers command – Show Mac OS X operating system version.
  3. uname command – Show operating system name and more.

Let us see how to find out macOS version on your Mac.

Determine macOS version from the command line

Open the terminal application and type the following command:
$ sw_vers

Fig. 01: Finding macOS (OS X) version from the command line

Where, you can pass the following options:
  1. -productName – Print just the value of the ProductName property.
  2. -productVersion – Display the value of the ProductVersion property.
  3. -buildVersion – Show the value of the BuildVersion property.

My Latest macOS

Say hello to system_profiler

You can use the system_profiler command as follows to get the same information:
$ system_profiler | less
$ system_profiler SPSoftwareDataType

Fig.02: Tell what version of OS X you are using on from the command line

Using SystemVersion.plist file

The above commands use /System/Library/CoreServices/SystemVersion.plist file. One can print the version info as follows:
$ cat /System/Library/CoreServices/SystemVersion.plist
Sample outputs:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>ProductBuildVersion</key>
	<string>15B42</string>
	<key>ProductCopyright</key>
	<string>1983-2015 Apple Inc.</string>
	<key>ProductName</key>
	<string>Mac OS X</string>
	<key>ProductUserVisibleVersion</key>
	<string>10.11.1</string>
	<key>ProductVersion</key>
	<string>10.11.1</string>
</dict>
</plist>

On Mac OS X server, try:
$ cat /System/Library/CoreServices/ServerVersion.plist
For macOS Big Sur, type the following cat command:
cat /System/Library/CoreServices/.SystemVersionPlatform.plist
And you will see:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>ProductBuildVersion</key>
	<string>20F71</string>
	<key>ProductCopyright</key>
	<string>1983-2021 Apple Inc.</string>
	<key>ProductName</key>
	<string>macOS</string>
	<key>ProductUserVisibleVersion</key>
	<string>11.4</string>
	<key>ProductVersion</key>
	<string>11.4</string>
	<key>iOSSupportVersion</key>
	<string>14.6</string>
</dict>
</plist>

How do I find out OS X Darwin kernel version?

Simply type the following uname command to see operating system name including the machine hardware name, the nodename, the machine processor architecture name, the operating system release, the operating system name, and the operating system version:
$ uname -av
Here is what I see on my Intel MacBook pro:

Darwin viveks-MacBook-Pro.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64

Tip: Read macOS version in audio format

Type the following bash command to hear macOS version using the say command:

say $(sw_vers) 
say $(sw_vers -productName && sw_vers -productVersion | sed 's/10//')
## for 11.x
say $(sw_vers -productName && sw_vers -productVersion)

Finding out macOS version using GUI

From the Apple menu, choose About This Mac. You should see the macOS name and other info as follows on screen:

Conclusion

You learned about determining your macOS version currently running on your Mac using CLI and GUI methods.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum