Finding OS X Version and Build Information From the Command Line

To find out what version (and often build number as well) of OS X you’re running using the Terminal, you’ve got several options. The first and likely the most obvious (and simple) is using sw_version.

macmeta:~ user$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.7.3
BuildVersion: 11D50d

You can retrieve the specific information that you want using the following options: -productName | -productVersion | -buildVersion

macmeta:~ aoi$ sw_vers -productVersion

You can cat out /System/Library/CoreServices/SystemVersion.plist and eyeball the XML that comes back. In my case:

macmeta:~ user$ cat /System/Library/CoreServices/SystemVersion.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
	<string>1983-2012 Apple Inc.</string>
	<string>Mac OS X</string>

Or you could merely add grep -C 2 ProductVersion.

macmeta:~ user$ cat /System/Library/CoreServices/SystemVersion.plist | grep -C 2 ProductVersion

Using system_profiler SPSoftwareDataType gives you lots of information including kernel version:

macmeta:~ user$ system_profiler SPSoftwareDataType
    System Software Overview:
      System Version: Mac OS X 10.7.3 (11D50d)
      Kernel Version: Darwin 11.3.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: macmeta
      User Name: USER (user)
      Secure Virtual Memory: Enabled
      64-bit Kernel and Extensions: Yes
      Time since boot: 56 minutes

Those accustomed to using ye olden *NIX uname -a will find that it only gives the Darwin kernel information.

macmeta:~ user$ uname -a
Darwin 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64

And I saved the ugliest for last! osascript is a tool that can be used to run AppleScript. with the -e option, it will run a single line script that you enter. Let’s try osascript -e 'system info':

macmeta:~ user$ osascript -e 'system info'
AppleScript version:2.2.1, AppleScript Studio version:1.5.2, system version:10.7.3, short user name:aoi, long user name:AOI, user ID:501, user locale:en_US, home directory:alias Macintosh HD:Users:aoi:, boot volume:Macintosh HD, computer name:macmeta, host, IPv4 address:, primary Ethernet address:40:6c:8f:0d:48:a6, CPU type:Intel 80486, CPU speed:2300, physical memory:2048

As you can see, it brings back a ton of info, including the system version.

Know of any other ways to find the system version and build numbers of OS X? Let me know in the comments.

One Comment

  1. [...] commands led me to this post: Finding OS X Version and Build Information From the Command Line | The Nubby Admin that also showed these [...]


Leave a Reply

Follow TheNubbyAdmin!

follow us in feedly

Raw RSS Feed:

Contact Me!

Want to hire me as a consultant? Have a job you think I might be interested in? Drop me a line:

Contact Me!

Subscribe via Email

Your email address is handled by Google FeedBurner and never spammed!

The Nubby Archives

Circle Me on Google+!

Photos from Flickr

Me on StackExchange

%d bloggers like this: