xcode-select should support selecting different tool chain versions per directory

Originator:dieter.komendera
Number:rdar://21579844 Date Originated:27-Jun-2015 08:19 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7 (7A121l)
Classification:Enhancement Reproducible:Always
 
Summary:
Right now, I have 3 Xcode versions installed. Xcode 6.3 for production stuff, 6.4 beta and 7 beta for testing.

However, I have multiple projects, each requiring a different version of the command line tools. Switching between the projects means also switching the command line tools with xcode-select -s <path>. Which is very easy to forget and result in errors.

It would be nice if we could specify a different version of the tools per project (= directory). Many other command line based toolchains have something similar, e.g rvm or rbenv for Ruby[1]

This would make it much easier to keep the production projects at the stable tool chains while experimenting with betas of upcoming versions.

[1]: https://github.com/sstephenson/rbenv#rbenv-local

Comments

Thank you Sam! I knew about DEVELOPER_DIR, but I want it to be automatic, so I can work on 2 projects simultaneously without having to worry about it. Also I'd like to be able to check it into git, so every body else on the project uses the same version automatically. Looks like https://github.com/neonichu/chswift is what I want, which I'm going to give a shot.

By dieter.komendera at June 29, 2015, 7:44 a.m. (reply...)

Work-around

You can force a specific version to be used per target by assigning the DEVELOPER_DIR environment variable to the path to the specific Developer directory you want to use. E.g.:

DEVELOPER_DIR = /Applications/Xcode-6.3.1.app/Contents/Developer <- this forces Xcode GUI to build with whatever version of the tools exist in Xcode version 6.3.1

DEVELOPER_DIR = /Applications/Xcode-7b1.app/Contents/Developer <- this forces Xcode GUI to build with whatever version of the tools exist in Xcode version 7 beta 1

This will over-ride whatever xcode-select is currently set to. I haven't tested this extensively with using xcodebuild on the command line so ymmv.

-- Sam Marshall

By sam0marshall at June 28, 2015, 3:54 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!