views:

437

answers:

2

How can I retrieve the information shown in the Mac's System Profiler app programatically? I'm actually interested in the USB section if that matters.

+3  A: 

The OSX command line tool "ioreg" might give you want you want.

man ioreg

ioreg displays the I/O Kit registry. It shows the heirarchical registry as an inverted tree.

Also if you can/want to use Cocoa look at IOKit. IOKit is the OSX framework that talks to USB hardware.

hacintosh
I think this is almost what I'm looking for. Two things though, I don't see the Volume information associated with the USB disk, for example the mount point. Second, is there a way to filter the output to get USB devices only?
Abdullah Jibaly
An easy way to see OS X volume information from the command line is either using df (I usually use "df -h" for human readable format) or using diskutil (command line tool is basically Disk Utility.app). If you run "diskutil list" that will show you volume information.
hacintosh
+1  A: 

Take a look at the system_profiler(8) command.

Dave Dribin