5

I have just upgraded my Mac OS to 10.9.3 from a Mac OS to 10.6.8. I had a XCode 3.2.6 installed. For new developments, I needed to install XCode 4.5.2.

In a maven build, I invoke xcodebuild to build some C++ projects. The problem is I need xcodebuild 3.2.6 to build certain projects, and xcodebuidl 4.5.2 for some new ones.

I need to be able to choose on-the-fly the xcodebuild version to launch a build on a project. I saw xcode-select could help me doing this, but I get stuck on the way to use xcode-select to choose xcodebuild 3.2.6.

Considerong my XCode 4.5.2 is installed at /Applications/Xcode.app, using command

sudo xcode-select -switch /Applications/Xcode.app

does the job, as

xcodebuild -version

outputs

Xcode 4.5.2
Build version 4G2008a

Considering my XCode 3.2.6 is at /Developer/Applications/Xcode.app, my problem is, why does this command not work?

sudo xcode-select -switch /Developer/Applications/Xcode.app

It outputs

xcode-select: error: invalid developer directory '/Developer/Applications/Xcode.app'

The only workaround I could find is using the absolute path to use xcodebuild 3.2.6, but that's tricky:

/Developer/usr/bin/xcodebuild

Is there a clean way to select xcodebuild 3.2.6 with xcode-select?

Rémi Doolaeghe
  • 2,262
  • 3
  • 31
  • 50
  • Does Mavericks support Xcode 3? – trojanfoe Jun 26 '14 at 08:26
  • Not officially, you're right. I am able to build with XCode 3 though, using GUI or absolute path. – Rémi Doolaeghe Jun 26 '14 at 08:45
  • I expect, then, that it's `xcode-select` (which I *think* was only introduced in Xcode 4). So for command line Xcode 3 builds you might have to manually construct paths to the compiler etc. Why are you using Xcode 3/4 at all, however, and not Xcode 5 throughout? – trojanfoe Jun 26 '14 at 08:49
  • I need building an InDesign plugin for a version that needs Mac OS 10.5 SDK support, what Xcode 3 is the only one to support. XCode 4 only supports 10.7+ SDK. I may use XCode 5 for later plugins... – Rémi Doolaeghe Jun 26 '14 at 08:58
  • Could you not take the Mac OS 10.5 SDK out of Xcode 3 and put it into the latest version of Xcode? That way you can just specify what SDK you are compiling against in the GUI or command line? – liamnichols Jun 28 '14 at 09:53
  • I've tried it, but it seems it is impossible: http://stackoverflow.com/questions/5310368/install-mac-os-x-sdk-10-5-on-snow-leopard. Furthermore, I couldn't get it work. – Rémi Doolaeghe Jun 30 '14 at 06:42

3 Answers3

0

You have to point path to /Contents/Developer folder in Xcode.app bundle.

Try this:

$ sudo xcode-select -switch /Developer/Applications/Xcode.app/Contents/Developer
Eimantas
  • 48,927
  • 17
  • 132
  • 168
  • I don't think I have to. I found several articles telling I could point to XCode.app or to XCode.app/Contents/Developer (and it works for XCode 4). Furthermore, there is no Contents/Developer folder in XCode 3 – Rémi Doolaeghe Jun 26 '14 at 11:42
0

It looks like xcode-select has not been developed to be compatible with Xcode 3... I used absolute path instead, there seems to be no other way.

Rémi Doolaeghe
  • 2,262
  • 3
  • 31
  • 50
-1

Doesn't Xcode 3 install the Developer directory to /Developer on your Startup Disk?

Could you install Xcode 3 and then try:

$ sudo xcode-select -switch /Developer
liamnichols
  • 12,419
  • 2
  • 43
  • 62
  • xcode-select: error: invalid developer directory '/Developer'. I tried it in the past too, thinking the same as you. But it seems it does not work. Furthermore, each time I see a xcode-select documentation, XCode 3 is not mentionned. – Rémi Doolaeghe Jun 27 '14 at 13:17