Re: Detecting OS X version from perl
Very Cool, on my iMini Gestalt says it's 10.4.9 osascript/fider says 10.4.7 sw_version 10.4.11 the latter is correct :-)-O on 10/16/07 2:52 AM Chris Nandor said the following: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (David Cantrell) wrote: Is there any simple way that people can think of to detect which major version of OS X my perl code is running on? ie whether it's 10.0, 10.1 etc, I don't care about the difference between 10.3.3 and 10.3.4. This is nice in that it doesn't depend on external processes (sw_vers, Finder) or files. use Mac::Gestalt qw(%Gestalt gestaltSystemVersion); (my $version = sprintf(%x, $Gestalt{gestaltSystemVersion()})) =~ s/^(\d+)(\d)(\d)$/$1.$2.$3/; -- If you want to email me, replace nospam with el
Re: Detecting OS X version from perl
On my 800Mhz Dual Processor PPC the AS command system info returns the correct version (10.4.11). Am 17.11.2007 um 12:21 schrieb Eberhard Lisse: Very Cool, on my iMini Gestalt says it's 10.4.9 osascript/fider says 10.4.7 I guess this is the version for the application Finder, not the OS! sw_version 10.4.11 the latter is correct :-)-O This AS tell application Finder set FinderVersion to version set OSVersion to product version return {FinderVersion, OSVersion} end tell returns {10.4.7, } So getting the OS version via the Finder seems to be broken - but there is an alternative, as shown above. Gestalt seems to be broken, however. ___ Peter Hartmann mailto:[EMAIL PROTECTED]
Re: Detecting OS X version from perl
Just a quick question. Is there a command line at a terminal window of MacOSX that can do this- tell you more about the hardware? Also list software packages and their revisions and also patches? Peter Hartmann wrote: On my 800Mhz Dual Processor PPC the AS command system info returns the correct version (10.4.11). Am 17.11.2007 um 12:21 schrieb Eberhard Lisse: Very Cool, on my iMini Gestalt says it's 10.4.9 osascript/fider says 10.4.7 I guess this is the version for the application "Finder", not the OS! sw_version 10.4.11 the latter is correct :-)-O This AS tell application "Finder" set FinderVersion to version set OSVersion to product version return {FinderVersion, OSVersion} end tell returns {"10.4.7", ""} So getting the OS version via the Finder seems to be broken - but there is an alternative, as shown above. Gestalt seems to be broken, however. ___ Peter Hartmann mailto:[EMAIL PROTECTED] -- Michael Barto Software Architect LogiQwest Inc. 16458 Bolsa Chica Street, # 15 Huntington Beach, CA92649 http://www.logiqwest.com/ [EMAIL PROTECTED] Tel:714 377 3705 Fax:714 840 3937 Cell: 714 883 1949 'tis a gift to be simple This e-mail may contain LogiQwest proprietary information and should be treated as confidential.
Re: Detecting OS X version from perl
Try 'system_profiler'. Running it as 'system_profiler -detaillevel full' will probably provide more information than you really need. Run it with an unrecognized option (e.g. '-help') for more info. On Nov 17, 2007, at 7:37 PM, Michael Barto wrote: Just a quick question. Is there a command line at a terminal window of MacOSX that can do this- tell you more about the hardware? Also list software packages and their revisions and also patches? Peter Hartmann wrote: On my 800Mhz Dual Processor PPC the AS command system info returns the correct version (10.4.11). Am 17.11.2007 um 12:21 schrieb Eberhard Lisse: Very Cool, on my iMini Gestalt says it's 10.4.9 osascript/fider says 10.4.7 I guess this is the version for the application Finder, not the OS! sw_version 10.4.11 the latter is correct :-)-O This AS tell application Finder set FinderVersion to version set OSVersion to product version return {FinderVersion, OSVersion} end tell returns {10.4.7, } So getting the OS version via the Finder seems to be broken - but there is an alternative, as shown above. Gestalt seems to be broken, however. ___ Peter Hartmann mailto:[EMAIL PROTECTED] -- Michael Barto Software Architect circle.gif LogiQwest Inc. 16458 Bolsa Chica Street, # 15 Huntington Beach, CA 92649 http://www.logiqwest.com/ [EMAIL PROTECTED] Tel: 714 377 3705 Fax: 714 840 3937 Cell: 714 883 1949 'tis a gift to be simple This e-mail may contain LogiQwest proprietary information and should be treated as confidential.
Re: Detecting OS X version from perl
On Nov 17, 2007, at 7:37 PM, Michael Barto wrote: Just a quick question. Is there a command line at a terminal window of MacOSX that can do this- tell you more about the hardware? Quick report: $ system_profiler -detailLevel mini Obsessive detail report: $ system_profiler -detailLevel full Also list software packages and their revisions and also patches? You can get a lot of this from skimming through the /Library/Receipts folder, e.g.: $ grep -A1 'BundleShortVersion' /Library/Receipts/*.pkg/Contents/ version.plist | grep string This works better up through Tiger; the package format changed with Leopard and there may be a new, better way to access that now (maybe run `lsbom` on files under /Library/Receipts, but that doesn't seem to have version data). You can also just query the app directly, modifying the example above, as: $ grep -A1 'BundleShortVersion' /Applications/*.app/Contents/ version.plist | grep string Which now that I think about it probably the way to go, as it's largely the same data as the Receipts folder, but also includes things that don't have an installer (e.g. Firefox, Skype, Adium) and things with a third-party installer (Microsoft Office, the Adobe CS suite, StuffIt, etc). * * * * * On a different tack, since this thread has come back up, I forget if it was mentioned the first time around, but the system version and build should always be available from: $ cat /System/Library/CoreServices/SystemVersion.plist This is useful if you ever need to check, say, a remote file server, or a machine in Firewire target mode, where you can't query system_profiler, sw_vers, etc. If you do the same for the Finder -- $ cat /System/Library/CoreServices/Finder.app/Contents/ version.plist -- it may or may not be in step with the SystemVersion (it probably would be, but checking the system itself is more direct). -- Chris Devers