rubymacoscocoamacrubyruby-cocoa

Read system information using macruby or ruby cocoa


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?


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.