How to open project files with Xcode 4 by default when installing Xcode 5 next

Xcode 4 is still my primary iOS development environment. To try iOS 7, I installed the Xcode 5 Developer Preview, and now all the files that were open for opening in Xcode 4 now open in Xcode 5.

How can I return Xcode 4 to the default editor again without uninstalling Xcode 5?

+6
source share
2 answers

After reading about LaunchServices in OS X, I finally found a solution, thanks for the @ peter-m tip.

To change the file association for a specific application, you can use the lsregister tool. To reregister the application, there is the -f option and unregister -u . Everything can be done with just one command:

  $ lsregister -f /Applications/Xcode.app 

Or if you want to unregister Xcode 5 and not touch it manually, set the 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 $PATH

Go to OS X to make changes.

+4
source

Assuming you don't have Xcode 5 projects yet, how about manually:

  • Find an Existing Xcode 4 Project (* .xcodeproj) Using Finder
  • Make Get Info File
  • Change Open with: to your preferred version of Xcode
  • Click Change All
  • Repeat for all types of files you want to open with Xcode 4

Or, if you want to try something more automatic, look: programmatically-script-atically-changing-the-default-open-with-setting

Based on the comment below, the problem seems to be related to command line builds that are building the wrong version of Xcode. In this case, I suggest looking at: xcode-build-and-archive-from-command-line , especially Raid's comment on his own answer, which says:

Works well in Xcode 4.4, and I'm sure it was good in 4.3 too. Make sure you select the correct release of Xcode using:

 xcode-select <path to Xcode.app> 

So, perhaps the correct solution is based on an understanding:

xcode-select - controls the path to the Xcode folder for the Xcode BSD tools.

+2
source

Source: https://habr.com/ru/post/951629/


All Articles