Which version of Xcode does xcodebuild use?

2019-03-08 15:25发布

I have installed both Xcode 3.2 and Xcode 4.0.2 on the same machine, which uses Hudson for automated CI (continuous integration) builds. When I say that both were installed, what I mean by that is that I can use both Xcode 3 and Xcode 4 simultaneously or interchangeably. They both exist on the machine, as I did a custom install for Xcode 4 without overwriting Xcode 3 (supposedly).

  • Do command line calls to 'xcodebuild' invoke Xcode 3 or Xcode 4?
    • Does that question even make sense? Someone who may or may not be knowledgable on the topic is requesting that some projects be built with 3 and some with 4.
  • If so, how do I force it to use 3 or 4?
    • alternatively, is there a separate location where Xcode 3's 'xcodebuild' is stored vs. where Xcode4's 'xcodebuild' is stored? If there is, I can just use a different path in my build script.

3条回答
甜甜的少女心
2楼-- · 2019-03-08 15:36

You can find out what version is xcodebuild using with xcode-select -print-path. Also, change to a different version using xcode-select -switch <path>

查看更多
来,给爷笑一个
3楼-- · 2019-03-08 15:44

Also, to determine which XCode environment is being used, use the command xcodebuild -version.

查看更多
乱世女痞
4楼-- · 2019-03-08 15:48

Outside the terminal, you can view and change this in Xcode.

Open Preferences, then select the Locations tab. Near the bottom, an entry titled Command Line Tools labels a dropdown, whose selection corresponds to the version of Xcode used in xcodebuild.

You may open this dropdown to select another version of Xcode that you have installed in your /Applications folder.

Screenshot illustrating the above-described solution.

查看更多
登录 后发表回答