Skip to content

platform.mac_ver() returns macOS version of 16.0 instead of 26.0 on Tahoe #135675

Open
@bwoodsend

Description

@bwoodsend

Bug report

Bug description:

macOS have switched their versioning scheme to calendar based so we're going 14 -> 15 -> 26 -> 27. Python is reporting the old versioning scheme.

> python -c 'import platform; print(platform.mac_ver())'
('16.0', ('', '', ''), 'arm64')
# Or
> python -m platform
macOS-16.0-arm64-arm-64bit

Apple appear to be pulling the same stunt with /System/Library/CoreServices/SystemVersion.plist (the file used to identify the macOS version) as they did with the 10.x -> 11 transition where, in order to avoid breaking code that made invalid assumptions about what the next macOS version would be, they instead broke it for everyone by making the file dynamically mislead any program which tries to read it which isn't compiled with SDK >=26.

Dynamic file contents!
> 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>BuildID</key>
	<string>B41EBE0C-41CA-11F0-B36A-391502BEE5D6</string>
	<key>ProductBuildVersion</key>
	<string>25A5279m</string>
	<key>ProductCopyright</key>
	<string>1983-2025 Apple Inc.</string>
	<key>ProductName</key>
	<string>macOS</string>
	<key>ProductUserVisibleVersion</key>
	<string>26.0</string>  # <--- Good
	<key>ProductVersion</key>
	<string>26.0</string>
	<key>iOSSupportVersion</key>
	<string>26.0</string>
</dict>
</plist>

> python -c 'print(open("/System/Library/CoreServices/SystemVersion.plist").read())'
<?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>BuildID</key>
	<string>B41EBE0C-41CA-11F0-B36A-391502BEE5D6</string>
	<key>ProductBuildVersion</key>
	<string>25A5279m</string>
	<key>ProductCopyright</key>
	<string>1983-2025 Apple Inc.</string>
	<key>ProductName</key>
	<string>macOS</string>
	<key>ProductUserVisibleVersion</key>
	<string>16.0</string>  # <--- Bad
	<key>ProductVersion</key>
	<string>16.0</string>
	<key>iOSSupportVersion</key>
	<string>26.0</string>
</dict>
</plist>

> otool -l /bin/cat | grep sdk
      sdk 26.0
> otool -l (pyenv which python) | grep sdk
      sdk 13.3

The behaviour is tied to the SDK version that Python is compiled with so this affects any existing builds of Python (including the official installers) and any builds done in the future not on SDK 26. It doesn't affect the (deprecated) system installation of Python which is compiled with the latest SDK. It is possible to get around this by installing the experimental Xcode command line tools for 26 then rebuilding Python from source.

Would it make sense for platform.mac_ver() to correct versions [16, 26) to their actual version?

CPython versions tested on:

3.15

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions