5 Replies Latest reply: Jul 3, 2008 5:41 AM by J D McIninch
cumbriacc Level 1 Level 1 (0 points)
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)
    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.
  • cumbriacc Level 1 Level 1 (0 points)
    Thanks for the reply.

    I have no experience with using the Apple Terminal what so ever so no idea how to make use of these commands, can anyone help?
  • BDAqua Level 10 Level 10 (120,925 points)
    Like JD says, just paste this into Terminal for starters...

    system_profiler SPApplicationsDataType
  • cumbriacc Level 1 Level 1 (0 points)
    Thanks, I have managed to get this working but i need to trim down the result, can i just display the Application name and nothing else?
  • J D McIninch Level 5 Level 5 (4,060 points)
    *$ 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+(.*):$/; }'*