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.
+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
2009-11-09 18:40:02
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
2009-11-09 18:56:09
Suggest you read the man page: `system_profiler -listDataTypes`, then `system_profiler -xml dataType1 ...`
Ned Deily
2009-11-09 19:15:59
Thanks ned, i found what i was looking for. I think can start using this now.
Unicorn
2009-11-10 05:29:25
A:
You can use the scripting bridge in Leopard (or newer) to get the information you want directly from Apple System Profiler.
Carl Norum
2009-11-09 18:41:06
+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
2009-11-10 01:31:08