On Sep 27, 2013, at 10:33 PM, Jens Alfke < email@hidden> wrote:
On Sep 27, 2013, at 10:18 PM, Chris Hanson < email@hidden> wrote:
Xcode has been self-contained since Xcode 2.5 specifically to support multiple installations: Prior to Xcode 4.3, you could have multiple /Developer folders installed. With Xcode 4.3 and later, everything is inside Xcode.app, and you can have multiple Xcode.app versions installed.
Agreed. The part I’m not sure of, though, is how you can do command-line builds with multiple versions of Xcode. This just came up in a meeting — I want our build-bots to build my stuff with Xcode 5, but we have some other projects that need to keep building in their existing environment to avoid unnecessary changes. I wasn’t sure how to invoke two different versions of xcodebuild from a shell or a Jenkins config. (xcode-select isn’t the answer, because it changes global state, but two build scripts might be running at the same time.)
Actually, xcode-select is the answer: The tools in /usr/bin like xcodebuild are stubs that indirect through the choice specified by xcode-select. This can be overridden by supplying DEVELOPER_DIR in the environment when the stub is invoked, as described in the man page.
So while xcode-select may point to one version of Xcode, you can use a different one for a command-line build via
$ env DEVELOPER_DIR=/Some/Other/Xcode.app/Contents/Developer xcodebuild archive
and so on. xcrun is the same way, with the added ability to invoke the tools appropriate to a specific platform and its architectures based on the SDK it's passed.
See the xcode-select and xcrun man pages for details.
-- Chris
|