Get Information from Mac’s System Profiler

I had need recently to get both the serial numbers and the processor information from all of the Macs on our domain here at work.  I had zero interest in visiting every desk to do this so I did some kicking around and found a fine command line tool where I could what I needed with a couple simple lines of code.

The utility, called System Profiler, has a command line element which is evoked by the command system_profiler.  I’ll show you a couple of examples (which I used to get the serial numbers and processor information).

First, to get the serial number for a machine I ssh’d to that machine (ssh root@machine-name) and ran this:

system_profiler | grep “r (system)”

(You will need to replace the fancy quotes above with regular un-fancy quotes if you use this at your terminal.)

And to get the processor information I ran this equally simple line of code:

system_profiler | grep Proc

Feel free to check the output on your own Mac.

You can also just run system_profiler, but you get a lot of output from that.

system_profiler

If you have some inkling of what you seek you could try something using grep (as I did above).  Note that you can find the exact string in my greps above in their respective outputs.  Play around with grep; it’s pretty harmless on its own.

Hope it helps you in your adventures.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *