views:

90

answers:

3

Is anybody knows any API that can help to distinguish Mac OS X "Server edition" from "Desktop edition"? My application should know on which edition of Mac OS X it currently running. (Server or Desktop)

+3  A: 

If there is a real reason why your application needs to know this, I'd recommend checking for the existence of the component that makes the difference on desktop/server. For example, if the server version comes with the program or library foo and the desktop version doesn't, and you would like to use foo, then check for the existence (and/or version of) foo instead of trying to infer it from Server vs Desktop OS.

(Meanwhile, one possible starting point to check the OS version are the commands sw_vers and system_profiler SPSoftwareDataType.)

Arkku
+1  A: 

Maybe you can find a difference using the sysctl API, or Gestalt

Macmade
I already checked this APIs, but Unfortunately I not found any suitable flags or parameters that will allow do this. (Gestalt have hundreds of flags and I failed to find the right one for this task)
Kirill
+5  A: 

sw_vers appears to do it by checking /System/Library/CoreServices/ServerVersion.plist -- you could probably get by with just seeing if the file exists.

Gordon Davisson
that’s actually what the very little in the way of Apple stuff which cares does, in my experience.
Mo