Get System Information from the Command Line in Mac OS X

Apr 23, 2007 - 13 Comments

Terminal in OS X Regardless of how many Mac’s you administer, there will surely come a time when you’ll need to retrieve relevant System Information. This can be done from the graphical interface with the Apple System Profiler utility, but often you’ll need to pull system details from the terminal as well.

Gathering system information from the command line is vital for system and network administration, so the next time you’ve accessed a machine through SSH, you can certainly find out what you need to know with two helpful command line tools. You can get almost any system details imaginable with these powerful utilities, each is slightly different, so here how, using the the sw_vers command and the system_profiler command:

How to Get Mac OS X System Version with sw_vers

The sw_vers command is short and sweet, it will give you the current Mac operating system version and build number of Mac OS X, with usage and output as such:

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.4.9
BuildVersion: 8P2137

How to Get Mac System Details with system_profiler

system_profiler is just a command line interface to the Mac GUI app System Profiler (which is found in the Utilities folder of Mac OS X). It’s very handy for learning about a machine over a network or remote connection via SSH. The standard output will blast you with screenfulls of content so it is best to pipe through the more command as follows:

$ system_profiler | more

This will allow you to view the output of system_profiler one screen at a time, navigable by the arrow keys and page up/down.

The system_profiler tool is often best used in conjunction with grep so that you can find specific information, whether that’s the video card used on a Mac, a display type, serial number, speed of a Mac, total installed memory, the manufacturer of a hard drive, or just about anything else.

Finding System Details with uname

Another option is the helpful uname command, best used with -a flag:

uname -a

The output of this includes the Mac OS X darwin kernel version, date, xnu release, whether the Mac is 64 bit (they all are if they’re new), etc like so:

$ uname -a
Darwin Retina-MacBook-Pro.local 15.3.0 Darwin Kernel Version 15.3.0: Mon Dec 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

Use whichever tool is necessary for the job, they’re all extremely useful.

If you’re looking for information on your Airport connection, be sure to use the hidden Airport utility discussed here.

.

Related articles:

Posted by: David Mendez in Command Line, How to, Mac OS, Tips & Tricks

13 Comments

» Comments RSS Feed

  1. BlackMoonWolf says:

    For most people, this will be the ideal command for their needs.

    system_profiler SPSoftwareDataType SPHardwareDataType

  2. Boyd Waters says:

    Take a look at the XML file at /System/Library/CoreServices/SystemVersion.plist

    See also the bless(8) command; “man bless” for more info.

  3. Rahav says:

    I am converting a Python program from Linux to OSX. The current program iterates through all of the attached devices with the following

    for f in glob.iglob(‘/sys/bus/usb/drivers/usb/*/product’):

    Is there an equivalent directory to the /sys on OSX?

    Thanks,
    Rahav

  4. danik says:

    i used this command
    hostinfo

  5. Javier says:

    Excuse me…:

    Good afternoon … I want to know how to extract the same information but in a copy that is Time Machine. I have a backup in Time Machine and would like to know that hard drive was at that moment and what was its serial number. Thank you very much!

  6. Javier says:

    Buenas tardes… me gustaría saber como extraer la información de lo mismo pero de una copia que está en Time Machine. Tengo una copia de seguridad en Time Machine y me gustaría saber que disco duro tenía en ese momento y cual era su numero de serie. Muchas gracias!

  7. Blu3fish says:

    Thank you much, worked like a charm.

    @srinivas Might want to spin up another discussion for that – or see if there is an existing one already spun.

    Cheers,
    Brennan

  8. srinivas says:

    Anyone know, how to create a group in mac os x leopad, i wanted to install oracle. And any info how to install oracle on iMac?

  9. mugab says:

    Jay’s tip is right but it doesn’t work on the Mac, is there a Mac OS X equivalent to the information in /proc ?

  10. Jay says:

    /proc is a wondrous thing on ubuntu/debian (and more I’m sure) distros

    cat /proc/cpuinfo for processor info

    cat /proc/meminfo for RAM status

  11. orville says:

    also you can use uname for unix related stats and information about your system

    uname -a

    it will spit back kernel info

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site