Question

Could someone tell me please how to read system information, such as OS version, versions of installed applications, and hardware details, using MacRuby or RubyCocoa?

Was it helpful?

Solution

You might be able to find what you need with NSProcessInfo:

>> NSProcessInfo.processInfo.operatingSystemVersionString
=> "Version 10.6.2 (Build 10C540)"
>> NSProcessInfo.processInfo.processorCount
=> 2
>> NSProcessInfo.processInfo.physicalMemory
=> 4294967296

Check out the Mac Dev Center for more.

OTHER TIPS

For the exhaustive apps and versions you can call

/usr/sbin/system_profiler

Read the man page first. Parse what you need. One challenge you run into is this might show more than what the user normally thinks of as installed apps. Remember apps can be in all kinds of places. Also this assumes you mean things bundled as .app bundles. (You do kind of need to ask yourself what an app is. Using a .app bundle is not a requirement for a GUI even though it certainly is the main way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top