Skip navigation
This discussion is archived

System Profiler

2677 Views 5 Replies Latest reply: Jul 3, 2008 5:41 AM by J D McIninch RSS
cumbriacc Calculating status...
Currently Being Moderated
Jul 2, 2008 4:26 AM
I am wanting to get some system information from 20 Macs running 10.4 before we upgrade them to Leopard. I know I can use System Profiler to get the information I require but the problem I am having is that the information I am getting out is either not detailed enough (mini or basic) or way too detailed (over 200 pages of it in a Full Report!).

I just want to get the basic system info - Machine Name, Processor type, speed, serial Number etc and also a list of applications installed on the Mac, I don't need detailed info about the software just the name of the apps.

Is there any utility out there that will allow me to extract only the data i require? I have searched numerous posts and googled for hours but can't find anything useful. I am mainly a Windows Support Engineer so don't know great deal about Apple OS (but learning fast).

If anyone has any ideas I would be grateful to hear them!
Mac OS X (10.4.10)
  • J D McIninch Level 5 Level 5 (4,060 points)
    Currently Being Moderated
    Jul 2, 2008 6:09 AM (in response to cumbriacc)
    The system_profiler utility (which you can access through Terminal.app and the shell, or remotely via SSH) does precisely what you want.

    For example, machine name, processor, speed, and serial number:

    *$ system_profiler SPHardwareDataype*

    {quote:title=... gives:}
    Hardware:

    Hardware Overview:

    Model Name: MacBook Pro 17"
    Model Identifier: MacBookPro2,1
    Processor Name: Intel Core 2 Duo
    Processor Speed: 2.33 GHz
    Number Of Processors: 1
    Total Number Of Cores: 2
    L2 Cache: 4 MB
    Memory: 2 GB
    Bus Speed: 667 MHz
    Boot ROM Version: MBP21.00A5.B08
    SMC Version: 1.14f5
    Serial Number: xxxxxxxxxxx
    Sudden Motion Sensor:
    State: Enabled
    {quote}

    And this:

    *$ system_profiler SPApplicationsDataType*

    {quote:title=... gives you:}
    Applications:

    Address Book:

    Version: 4.1.1
    Last Modified: 6/23/08 7:51 AM
    Kind: Universal
    Get Info String: 4.1, Copyright Apple Inc. 2002-2007
    Location: /Applications/Address Book.app

    Adium:

    Version: 1.2.5
    Last Modified: 6/24/08 11:32 AM
    Kind: Universal
    Get Info String: 1.2.5, Copyright 2001-2008 The Adium Team
    Location: /Applications/Adium.app

    ...
    {quote}

    With a smidgen of PERL to reformat the output, you can generate a nicely formatted report out of that, I should think.
    24" iMac, 17" MacBook Pro, Mac OS X (10.5.1), also many Linux PCs and one WinXP laptop
  • BDAqua Level 10 Level 10 (114,695 points)
    Currently Being Moderated
    Jul 3, 2008 2:14 AM (in response to cumbriacc)
    Like JD says, just paste this into Terminal for starters...

    system_profiler SPApplicationsDataType
  • J D McIninch Level 5 Level 5 (4,060 points)
    Currently Being Moderated
    Jul 3, 2008 5:41 AM (in response to cumbriacc)
    *$ system_profiler SPApplicationsDataType | grep -E :\$ | sed -e 's/://'*

    ... but, you probably owe it to yourself to discover the wonders of Perl scripting. I generally consider basic working knowledge of Perl a basic system administrator skill, regardless of whether you're talking about Mac OS X, Windows, or Linux/UNIX:

    *$ perl -e 'for (`system_profiler SPApplicationsDataType`) { print "$1\n" if /\s+(.*):$/; }'*

    'perl -e' just means use perl to run what follows. The rest means: for each line in the result of the system_profile command, print the value of the indicated part of the match if the string matches the pattern "1 or more spaces, some text, colon, end-of-line".

    {quote:title=You'd generally put your perl in a text file:}
    #!/usr/bin/perl
    for (`system_profiler SPApplicationsDataType`) {
       print "$1\n" if /\s+(.*):$/;
    }
    {quote}

    ... then make the file executable:

    *$ chmod a+rx myscript.pl*

    ... and run the script:

    *$ ./myscript.pl*

    Using the one-liner, though, you could use SSH to run the script remotely, for example:

    *$ ssh remotemac.mycompany.com perl -e 'for (`system_profiler SPApplicationsDataType`) { print "$1\n" if /\s+(.*):$/; }'*
    24" iMac, 17" MacBook Pro, Mac OS X (10.5.1), also many Linux PCs and one WinXP laptop

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.