Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Run System Profiler from the Terminal -- revisited UNIX
I was recently pointed to a CLI version of Apple System Profiler as a way to gather information on workstations. I'm still working on how I might use the command and parse the data, but I thought I'd share the command here as I couldn't find it on the site via the search engine. Here's the command:
system_profiler
It can be redirected to a text file like this:
system_profiler > profiler_output.txt
The only flags the utility seems to take is one that causes the output to be in XML. I'm sure that could be handy for folks that want to process the data in that form:
system_profiler -xml > profiler_output.xml
[robg adds: This appears to be the replacement for the AppleSystemProfiler command that was covered in this hint, but vanished with the release of Jaguar. If you don't run it in redirected mode, make sure you give it some time to finish its output!]
    •    
  • Currently 3.25 / 5
  You rated: 3 / 5 (4 votes cast)
 
[12,575 views]  

Run System Profiler from the Terminal -- revisited | 8 comments | Create New Account
Click here to return to the 'Run System Profiler from the Terminal -- revisited' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Run System Profiler from the Terminal -- revisited
Authored by: g3ski on Jun 20, '03 02:34:58PM

Is there a way to choose what output to get? ie, just the hardware overview, or the devices and volumes.

I realize that I can just cancel the command after I get basics, but thought there might be other ways to amaze and amuze.

I didn't see a man page for "system_profiler"

---
"I want my two dollars!"



[ Reply to This | # ]
Run System Profiler from the Terminal -- revisited
Authored by: Trunkmonkey on Jun 23, '03 11:10:06AM

If you're looking for a specific line of text you can use the grep command:

system_profiler | grep SODIMM

Worked great when a friend needed me to test quite a few gigs of SODIMMs. Drop in two 512MB SODIMMs, reboot in single user, run system_profiler | grep SODIMM, shut down, drop in two more 512MB SODIMMs, et al.

[ Reply to This | # ]

Run System Profiler from the Terminal -- revisited
Authored by: Guano_Jim on Oct 24, '03 11:20:15AM
One way would be to pipe it through a grep... e.g

system_profiler | grep "Customer serial number:"

returns something like:

Customer serial number: QT2885K1-P1S-fe12

Which you could then parse any way you like.

[ Reply to This | # ]
Customize reports
Authored by: DaMacGuy on Jan 02, '04 11:14:56PM
With, at least, the release of 10.3 you can.
system_profiler -listDataTypes
You can get specific info by using
system_profiler datatype datatype etc...

---
-DaMacGuy

[ Reply to This | # ]

Run System Profiler from the Terminal -- revisited
Authored by: matx666 on Jun 20, '03 02:56:14PM

"AppleSystemProfiler" used to work in Jaguar and only recently they must have changed it. Now if you run this command it launches the actual app. Weird. I noticed this change recently. I wonder which update did this, 10.2.6?



[ Reply to This | # ]
Run System Profiler from the Terminal -- revisited
Authored by: gvitale on Jun 23, '03 03:33:31AM

it was like this already with 10.2(.0)



[ Reply to This | # ]
AppleSystemProfiler
Authored by: gatorparrots on Jul 15, '03 11:28:00PM
AppleSystemProfiler > ~/Desktop/asp.txt
works just fine here under 10.2.6, as does
AppleSystemProfiler
which dumps the results to stdout.

Yes, the GUI Apple System Profiler.app application launches, but it is just used to gather the results. The information gathered can be redirected to a text file, dumped into the shell, or grepped/awked for finer output or specific information.

[ Reply to This | # ]

Run System Profiler from the Terminal -- revisited
Authored by: macubergeek on Jun 21, '03 10:07:55AM

You don't need to use the -xml flag on the command just use:
system_profiler>output.txt and it works fine.

Interestingly it also reads the system log and ipfw log files as well.



[ Reply to This | # ]