[Openmcl-devel] Determining OSX version at runtime

peter p2.edoc at googlemail.com
Fri Aug 27 07:57:05 UTC 2010

So failing Daniel's valid requirements (OS version via ugly string stuff):

(defun os-version-values ()
   "Returns values of major and minor System version"
   (let* ((string (software-version))
          (1st-. (position #\. string)))
     (values (- (read-from-string string nil nil :end 1st-.) 4)
             (read-from-string string nil nil :start (1+ 1st-.)
                               :end (position #\. string :start (1+ 1st-.))))))

(defun darwin-p ()
   (equalp (software-type) "Darwin"))

(defvar *macos-10.6.4-p*
   (when (darwin-p)
     (multiple-value-bind (major minor) (os-version-values)
       (and (eq major 6) (eq minor 4) T))))

(defvar *macos-leopard-p*
   (and (darwin-p) (eq 5 (os-version-values)) T))

(defvar *macos-snow-leopard-p*
   (and (darwin-p) (eq 6 (os-version-values)) T))

#|(if *macos-leopard-p* (pushnew :macos-10.5 *features*)
   (if *macos-snow-leopard-p* (pushnew :macos-10.6 *features*)))|#

;; etc

At 10:08 PM -0700 10/8/26, Neil Baylis wrote:
>There's a feature that's available in 10.6 that's not available in 
>10.5, specifically, the ability to assign an NSImage directly to the 
>content property of a CALayer in Apple's Core Animation technology.
>On Thu, Aug 26, 2010 at 9:35 PM, 
><<mailto:dherring at tentpost.com>dherring at tentpost.com> wrote:
>  > What's the correct way to determine the OSX version at runtime?
>>  Specifically, how do I make the behavior change if it's 10.6 or later?
>I suspect this is the wrong question to be asking.  Are you really wanting
>to print "10.5" or "10.6"?  Or are you asking because feature X is not
>available on older versions?  Or does feature Y exist but crash
>frequently?  Is feature Y's fix readily detectable?
>Feature-specific tests that probe for functionality often perform better
>than hard coded lookup tables of known configurations (that don't handle
>unusual configurations and aren't updated in the future)...
>- Daniel
>Openmcl-devel mailing list
><mailto:Openmcl-devel at clozure.com>Openmcl-devel at clozure.com
>Openmcl-devel mailing list
>Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list