When xcodes uninstall is used to delete a Xcode version, this Xcode version isn't unregistered from LaunchServices, so this old version remains on the LaunchServices database indefinitely.
This can be checked with this command: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep <XCODE_FOLDER>
More info about the unregistering apps from LaunchServices here.
Possible solutions:
Find a replacement for removeItem(atPath:) that also updates the LaunchServices database.
Add a new phase to xcodes uninstall to unregister the uninstalled Xcode version (/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f -u <XCODE_PATH>, although this command doesn't seem to work for the apps inside Xcode).
When
xcodes uninstall
is used to delete a Xcode version, this Xcode version isn't unregistered from LaunchServices, so this old version remains on the LaunchServices database indefinitely./System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep <XCODE_FOLDER>
Possible solutions:
removeItem(atPath:)
that also updates the LaunchServices database.xcodes uninstall
to unregister the uninstalled Xcode version (/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f -u <XCODE_PATH>
, although this command doesn't seem to work for the apps inside Xcode).