Xcode 4 is still my main IDE for iOS development. To try the upcoming iOS 7 I installed Xcode 5 Developer Preview and now all the files that were used to open in Xcode 4 now open in Xcode 5.
How can I revert Xcode 4 to be default editor again without uninstalling Xcode 5?
After reading about LaunchServices in OS X I have finally found the solution, thanks for the hint @peter-m.
To modify files association for certain app one can use lsregister
tool. So to re-register the app there is -f
parameter, and to unregister -u
. Everything can be in fact done with just one command:
$ lsregister -f /Applications/Xcode.app
Or if you want to unregister Xcode 5 and not touch manually set associations earlier:
$ lsregister -u /Applications/Xcode5-DP5.app
lsregister
is located in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/
, so add it to your $PATH
Re-login to OS X for changes to apply.
Assuming you don't have any Xcode 5 projects yet, how about manually:
Get Info
of the fileOpen with:
to your desired version of XcodeChange All
Or if you want to try something more automatic take a look at: programmatically-script-atically-changing-the-default-open-with-setting
Based on the comment below, the problem seems to be with command line builds picking the wrong version of Xcode. In that case I suggest looking at: xcode-build-and-archive-from-command-line, especially the Reid's comment to his own answer which says:
Works fine in Xcode 4.4, and I'm sure it was fine in 4.3 as well. Make sure you have selected the correct Xcode release by using:
xcode-select <path to Xcode.app>
So perhaps the correct solution is based around understanding:
xcode-select -- Manages the path to the Xcode folder for Xcode BSD tools.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With