Go Back   The macosxhints Forums > OS X Help Requests > System



Reply
 
Thread Tools Rate Thread Display Modes
Old 08-16-2005, 05:29 AM   #1
The Joker
Prospect
 
Join Date: Jul 2005
Location: Gothenburg, Sweden
Posts: 9
system_profiler command in different OS X versions

I have a question regarding the system_profiler terminal command. In which OS X version was it introduced and which versions added functionality to it? Supposedly the ability to save as xml (e.g system_profiler -xml > mydata.xml) was added in Panther (I'm not positive though), but what about the option to only include certain data types? (system_profiler -listDataTypes) I know Tiger made the System Profiler application look up more info, but that's not what I'm asking about here.

If anyone of you are using or have used previous versions of OS X (specifically 10.1 and 10.2) it would be helpful. Thanks.
The Joker is offline   Reply With Quote
Old 08-16-2005, 06:59 AM   #2
yellow
Moderator
 
Join Date: Jan 2002
Posts: 10,677
/usr/sbin/system_profiler exsisted at least as far back as 10.2. I don't know about 10.1.. only I ran that and ditched it as soon as Jaguar was available (10.1 really sucked).
yellow is offline   Reply With Quote
Old 08-16-2005, 12:45 PM   #3
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,551
In 10.0.x and 10.1.x, the terminal command was
AppleSystemProfiler

You could get further information with
AppleSystemProfiler -help

As yellow mentions, in 10.2.x and newer, the terminal command is
system_profiler

Trevor
trevor is offline   Reply With Quote
Old 08-18-2005, 05:56 AM   #4
The Joker
Prospect
 
Join Date: Jul 2005
Location: Gothenburg, Sweden
Posts: 9
Thanks guys.
The Joker is offline   Reply With Quote
Old 09-05-2005, 08:51 AM   #5
drone540
Triple-A Player
 
Join Date: Jul 2004
Posts: 107
Anybody know how I can grab only lines from this command:
system_profiler SPHardwareDataType

I just want CPU speed, Machine Model, CPU Type for a PHP script.

I forgot how to process text with php.
drone540 is offline   Reply With Quote
Old 09-05-2005, 10:04 AM   #6
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,551
There's probably a much more efficient way to do this, but how about:

system_profiler | grep CPU\ Speed
system_profiler | grep Machine\ Model
system_profiler | grep CPU\ Type


Trevor
trevor is offline   Reply With Quote
Old 09-05-2005, 10:25 AM   #7
NovaScotian
Hall of Famer
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,946
Quote:
Originally Posted by trevor
There's probably a much more efficient way to do this, but how about:
system_profiler | grep CPU\ Speed
system_profiler | grep Machine\ Model
system_profiler | grep CPU\ Type

Trevor

Wow! That was pretty spectacular - I escaped the back slash and ran the first of these as an AppleScript "do shell script ...." and absolutely froze the Script Editor. Trying again in the Terminal I got an error message from the parser, and had to Control-C my way out. Restarting to be on the safe side, my dock was all messed up. Talk about unintended consequences (at least in my otherwise perfectly functioning 10.3.9). Running the Cocktail Pilot functions now to straighten things out.
NovaScotian is offline   Reply With Quote
Old 09-05-2005, 11:11 AM   #8
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,551
NovaScotian, the backslash IS the escape character. If you wish, you can
system_profiler | grep 'CPU Speed'
...for example.

There's no way that running these should give you freezing, that must be due to another problem on your computer. I launched Script Editor and entered
do shell script "system_profiler | grep 'CPU Speed'"
and in the Result tab I properly received
" CPU Speed: 1 GHz"

Trevor
trevor is offline   Reply With Quote
Old 09-05-2005, 11:46 AM   #9
NovaScotian
Hall of Famer
 
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,946
Quote:
Originally Posted by trevor
NovaScotian, the backslash IS the escape character. If you wish, you can
system_profiler | grep 'CPU Speed'
...for example.

There's no way that running these should give you freezing, that must be due to another problem on your computer. I launched Script Editor and entered
do shell script "system_profiler | grep 'CPU Speed'"
and in the Result tab I properly received
" CPU Speed: 1 GHz"

Trevor

My bad. You are absolutely correct. What I hadn't anticipated was that the result took a long time, so I thought the Script Editor had frozen. Force quitting it probably did the deed, but all is well again.
NovaScotian is offline   Reply With Quote
Old 09-05-2005, 12:12 PM   #10
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,551
Quote:
Originally Posted by NovaScotian
What I hadn't anticipated was that the result took a long time, so I thought the Script Editor had frozen.

Ah, yes, it does take some time. That's why I said that there was probably a much more efficient way to do this.

Trevor
trevor is offline   Reply With Quote
Old 09-05-2005, 03:09 PM   #11
bramley
MVP
 
Join Date: Apr 2004
Location: Cumbria, UK
Posts: 2,461
And there's
Code:
system_profiler SPHardwareDataType|grep "CPU Speed"|awk -F: '{print $2}'
system_profiler SPHardwareDataType|grep "Machine Model"|awk -F: '{print $2}'
system_profiler SPHardwareDataType|grep "CPU Type"|awk -F: '{print $2}'
bramley is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 03:10 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.