[Mono-dev] Why does Environment.OSVersion.Platform report PlatformID.Unix on OS X?

Uli Hertlein uli at xdt.com.au
Sun Nov 13 20:48:45 EST 2011

Hi guys,

the subject pretty much sums it up.

Environment.OSVersion.Platform on OS X reports PlatformID.Unix rather 
than PlatformID.MacOSX.

The responsible code in mcs/class/corlib/System/Environment.cs 
explicitly remaps PlatformID.MacOSX to Unix:

public static OperatingSystem OSVersion {
   get {
     if (os == null) {
       Version v = Version.CreateFromString (GetOSVersionString ());
       PlatformID p = Platform;
       // UH: Why is this remapped?
       if (p == PlatformID.MacOSX)
         p = PlatformID.Unix;
       os = new OperatingSystem (p, v);
     return os;

While I totally agree that OS X *is-a* Unix-like operating system, 
shouldn't this report the highest-level of detail that is available, 
rather than throwing away useful information?


More information about the Mono-devel-list mailing list