The function "Gestalt()" is deprecated on 10.8 #101

jwilling opened this Issue Oct 2, 2012 · 7 comments


None yet
3 participants

jwilling commented Oct 2, 2012

The use of Gestalt() was introduced in commit 2fe3834 to see if we're running on Lion or above. As of 10.8, this function is deprecated.

sysctl(3) should be used instead, perhaps.

avaidyam commented Oct 2, 2012

sysctl(3) is a LOT harder than Gestalt() to check for, but sure. I'll patch that in.

avaidyam commented Oct 5, 2012

Actually, I haven't found a way to use sysctl yet. Has anyone a hint for me? :D

avaidyam commented Oct 5, 2012

#include <errno.h>
#include <sys/sysctl.h>

char str[256];
size_t size = sizeof(str);
int ret = sysctlbyname("kern.osrelease", str, &size, NULL, 0);

Is the closest I can get-- but Darwin release numbers MAY or MAY NOT correspond to OS X.

jwilling commented Oct 6, 2012

I believe the kernel number for Lion was 11, if I'm not mistaken. Anything above that should be safe to use the Lion+ classes on.

avaidyam commented Oct 6, 2012

We could also use NSAppKitVersionNumber which might be a cleaner way.

NSAppKitVersionNumber wasn't bumped from 10.7.4 to 10.8.0 (I believe), so it may not be entirely reliable.

avaidyam commented Oct 8, 2012

Alright, then I'll open a PR for sysctl(3) tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment