diff --git a/cmake/QtPublicAppleHelpers.cmake b/cmake/QtPublicAppleHelpers.cmake
index 3df15d66082..7786fed8c60 100644
--- a/cmake/QtPublicAppleHelpers.cmake
+++ b/cmake/QtPublicAppleHelpers.cmake
@@ -116,10 +116,24 @@ function(_qt_internal_find_apple_development_team_id out_var)
# Extract the first account name (email) from the user's Xcode preferences
message(DEBUG "Trying to extract an Xcode development team id from '${xcode_preferences_path}'")
- execute_process(COMMAND "/usr/libexec/PlistBuddy"
- -x -c "print IDEProvisioningTeams" "${xcode_preferences_path}"
- OUTPUT_VARIABLE teams_xml
- ERROR_VARIABLE plist_error)
+
+ # Try Xcode 16.2 format first
+ _qt_internal_plist_buddy("${xcode_preferences_path}"
+ COMMANDS "print IDEProvisioningTeamByIdentifier"
+ EXTRA_ARGS -x
+ OUTPUT_VARIABLE teams_xml
+ ERROR_VARIABLE plist_error
+ )
+
+ # Then fall back to older format
+ if(plist_error OR NOT teams_xml)
+ _qt_internal_plist_buddy("${xcode_preferences_path}"
+ COMMANDS "print IDEProvisioningTeams"
+ EXTRA_ARGS -x
+ OUTPUT_VARIABLE teams_xml
+ ERROR_VARIABLE plist_error
+ )
+ endif()
# Parsing state.
set(is_free "")
@@ -152,6 +166,16 @@ function(_qt_internal_find_apple_development_team_id out_var)
# ...
#
#
+ # AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE
+ #
+ #
+ # isFreeProvisioningTeam
+ #
+ # teamID
+ # CCC
+ # ...
+ #
+ #
#
#
if(teams_xml AND NOT plist_error)