views:

264

answers:

4

Is there any method / API defined to collect system info in osx. I want to write utility which will collect hardware information like CPU,RAM,Network adapter. Any idea ? Thanks in advance.

+2  A: 

The following link should be enough to get you started:

How to get hardware and network configuration

ennuikiller
+4  A: 

The easiest way is to use the output from the system_profiler command. It also has an -xml option to make the output easy to automatically parse.

Ned Deily
This give good amount of information. Thanks for this.Just wondering that if is there any API to query for specific information. Like only for memory or lets say processors.
Unicorn
Suggest you read the man page: `system_profiler -listDataTypes`, then `system_profiler -xml dataType1 ...`
Ned Deily
Thanks ned, i found what i was looking for. I think can start using this now.
Unicorn
A: 

You can use the scripting bridge in Leopard (or newer) to get the information you want directly from Apple System Profiler.

Carl Norum
+3  A: 

The underlying API that I believe System Profiler uses (for at least some of the information it gathers), and that you should use if you want very specific information, is sysctl. It lets you query for individual attributes of the system, including number of CPUs, CPU speed, available RAM, etc.

Kevin Ballard