How to detect Darwin version?

system_profiler SPSoftwareDataType

02