Recently I needed to gather some statistics about the distribution of the different Mac OS X versions installed by users of a certain application.
Since the application has an update-check feature, I thought I'd use the web server logs to infer the data I was interested in. The only thing I could use was the
User-Agent string sent by the application when requesting the file containing the update information.
After some digging in Darwin's build plists and a bit of googling, I came up with this list of patterns:
OS | user agent pattern
--------------------------+---------------------------------------------------
Mac OS X 10.2 | ^CFNetwork/1\.1$
Mac OS X 10.3.2-10.3.8 | ^CFNetwork/1\.2\.1$
Mac OS X 10.3.9 | ^CFNetwork/1\.2\.[2-6]$
Mac OS X 10.4 | ^CFNetwork/128$
Mac OS X 10.4.10 | ^CFNetwork/129\.21$
Mac OS X 10.4.11 | ^CFNetwork/129\.22$
Mac OS X 10.4.2 | ^CFNetwork/128\.2$
Mac OS X 10.4.3 | ^CFNetwork/(129\.5|10\.4\.3)$
Mac OS X 10.4.4 | ^CFNetwork/(129\.(9|10)|10\.4\.4)$
Mac OS X 10.4.5 | ^CFNetwork/129\.11$
Mac OS X 10.4.6 | ^CFNetwork/129\.13$
Mac OS X 10.4.7 | ^CFNetwork/(129\.16|4\.0)$
Mac OS X 10.4.8 | ^CFNetwork/129\.1(8|9)$
Mac OS X 10.4.9 | ^CFNetwork/129\.20$
Mac OS X 10.5 | ^CFNetwork/21[7-9]$
Mac OS X 10.5.1 | ^CFNetwork/220$
Mac OS X 10.5-prerelease | ^CFNetwork/1[4-9][0-9](\.[0-9])?|20[0-9]|21[0-9]$
They might not be 100% correct, but they're good enough.