in reply to Re^2: Get macOS Version
in thread Get macOS Version

That should be simple enough. The host OS will have Perl installed (as far as I know it has been installed by default since the first OS X). Have your app's perl find out where the system perl is (maybe a system call to which perl?) and then use that perl to examine its Config.

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^4: Get macOS Version
by Your Mother (Archbishop) on Oct 25, 2018 at 15:46 UTC

    It’s been almost 20 years but IIRC you are quite right. The OS X beta had the dev tools more “above the fold” than OS X currently does, again, if I’m remembering correctly. I do remember how goddamn painful getting modperl installed was. 80% my systardiness and 20% dearth of documentation on a bleeding edge OS.

    Also, thanks for the Config reminder. Just yesterday I wrote a test that should have used it but I went all qx{} on it like a dummy. :P

Re^4: Get macOS Version
by Anonymous Monk on Oct 25, 2018 at 14:47 UTC

    Ah, so simple. Didn't thought about it! I'll give it a try, but it seems a good solution. Cheers.

      Well, as long as you are shelling out with a system call, there is probably a native MacOS program to tell you the OS version ... I just always think of Perl solutions :-)

      Update: sw_vers -productVersion seems to be the needed utility:

      $ perl -E'say qx/sw_vers -productVersion/' 10.12.6
      Note that this is a different value than that shown by using Config!
      $ perl -MConfig -E'say $Config{osvers}' 16.7.0
      The latter appears to be the macOS build version, in fact, and can be different from the time Perl was built to the present:
      $ perl -E'say qx/sw_vers -buildVersion/' 16G1510

      Hope this helps!


      The way forward always starts with a minimal test.