stanislav-tkach/os_info

Switch macos detection to use SystemVersion.plist

orf opened this issue · 2 comments

orf commented

The way Python detects the MacOS version uses the file /System/Library/CoreServices/SystemVersion.plist:

❯ cat /System/Library/CoreServices/SystemVersion.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>ProductBuildVersion</key>
    <string>22D49</string>
    <key>ProductCopyright</key>
    <string>1983-2023 Apple Inc.</string>
    <key>ProductName</key>
    <string>macOS</string>
    <key>ProductUserVisibleVersion</key>
    <string>13.2</string>
    <key>ProductVersion</key>
    <string>13.2</string>
    <key>iOSSupportVersion</key>
    <string>16.3</string>
</dict>
</plist>

Would it be faster and potentially more efficient to use this rather than invoking sw_vers and parsing the output?

Thank you for the suggestion, I think it is a good idea. I can do that myself, but please let me know if you want to try to implement that. 🙃

orf commented

I love to try and implement it, thanks! I’ll give it a shot this weekend or next weekend.