|
|
#1 |
|
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. |
|
|
|
|
|
#2 |
|
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).
|
|
|
|
|
|
#3 |
|
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
__________________
How to ask questions the smart way |
|
|
|
|
|
#4 |
|
Prospect
Join Date: Jul 2005
Location: Gothenburg, Sweden
Posts: 9
|
Thanks guys.
|
|
|
|
|
|
#5 |
|
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. |
|
|
|
|
|
#6 |
|
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
__________________
How to ask questions the smart way |
|
|
|
|
|
#7 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,946
|
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. |
|||||||||||||||||||||||
|
|
|
|
|
#8 |
|
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
__________________
How to ask questions the smart way |
|
|
|
|
|
#9 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,946
|
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. |
|||||||||||||||||||||||
|
|
|
|
|
#10 | |||||||||||||||||||||||
|
Moderator
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,551
|
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
__________________
How to ask questions the smart way |
|||||||||||||||||||||||
|
|
|
|
|
#11 |
|
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}'
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|