Note: This approach is usually not suitable for CI/Remote Builds because this is a popular option to disable Spotlight to improve performance. The easiest way to get the list of installed Xcode versions is to ask the Spotlight with the following command: mdfind "kMDItemCFBundleIdentifier = '.Xcode'" # Output /Volumes/Extended/Archives/Xcode_12.5.app /Volumes/Extended/Archives/Xcode_12.4.app /Volumes/Extended/Archives/Xcode_12.1.app /Volumes/Extended/Archives/Xcode_12.3.app /Volumes/Extended/Archives/Xcode_12.2.app List of installed Xcode versions Spotlight Perhaps, this is the fastest way to obtain the path, but it is not documented, and Apple can break it with any following Xcode release. To check the current selected Xcode version without xcode-select, evaluate the following command: readlink /private/var/db/xcode_select_link # Output /Volumes/Extended/Archives/Xcode_12.5.app/Contents/DeveloperĮvery time you switch the default Xcode, xcode-select changes the link to the selected version. It can be helpful in some cases, but I recommend using xcode-select if you have no additional requirements. There is a trick to get the current selected Xcode version without the xcode-select tool. Note: If you wonder why I prefix the xcode-select with xcrun command, please, check the Multiple Xcode versions or Why xcrun is your friend article. This is useful for inspection, but scripts and other tools should use xcrun(1) to locate tool inside the active developer directory. Prints the path to the currently selected developer directory. This is the most common way to get the path to the selected instance: xcrun xcode-select -print-path # Output /Volumes/Extended/Archives/Xcode_12.5.app/Contents/Developer How to get the current selected Xcode and list installed Current Selected Xcode xcode-select
0 Comments
Leave a Reply. |