Updating to Xcode 4.3Feb 17, 2012 · 4 minute read
As if all the excitement of Mountain Lion was not enough for this week Apple has also pushed out Xcode 4.3. The big change is that Xcode is now a standard Mac App Store package which installs directly into the Applications directory. Previously when you installed from the App Store you rather confusingly downloaded an Xcode installer into the Applications directory which you then ran to install Xcode into /Developer.
Xcode 4.3 is a free download from the Mac App Store which, once it has downloaded, will install directly into the /Applications directory. You no longer even get an installation dialog offering you a choice of the installation directory though I guess there is nothing to stop you from moving it later. (Note that if you are developing for the iOS 5.1 beta release you should continue to use the Xcode 4.3 Developer preview available from the iOS Dev Center.)
Once the download is complete you should find Xcode installed in your /Applications folder just like any other App Store application. When you run Xcode for the first time you are prompted to remove the old version of Xcode that is in installed in /Developer (version 4.2.1 in my case) and also to delete the now redundant Xcode installer from /Applications:
Of course if you want to maintain the older version for a while you are not forced to delete it right now you just need to manually drag the relevant files to the trash when you are ready.
As we have previously seen with Xcode 4.2 you need to download some optional components from the preferences if you want the iOS 4.3 Simulator or device debugging support for iOS versions prior to iOS 4.3. What has changed with Xcode 4.3 is that even the command-line tools are now an optional download:
The interesting thing about the command line tools being a separate download is that it means they can now be installed without Xcode making life easier if you just want the compiler or OS X header files. The download link for the command line tools and a number of other optional tools that are now no longer bundled with Xcode can be found on the Apple developer site.
/Developer Be Gone
It is somewhat odd to be developing on a Mac that does not have a /Developer directory. One immediate impact of this will be on any scripts you have that rely on command-line tools that previously lived in /Developer. For example I often used the agvtool to manage build version numbers but if you try to run it after installing Xcode 4.3 you will get the following error message:
$ agvtool Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
The xcode-select utility allows you to switch between versions of Xcode which makes it easy to correct the problem:
$ sudo /usr/bin/xcode-select -switch /Applications/Xcode.app
If you are wondering where all of the files that were previously under /Developer have gone you can find them by right-clicking on the Xcode.app file in the Applications folder and showing the package contents. The old /Developer/usr/bin directory is now in /Applications/Xcode.app/Contents/Developer/usr/bin.
Don’t forget to clean up your shell environment if you previously referred to anything under /Developer. So for example, if you added /Developer/usr/bin to your PATH and /Developer/usr/share/man to your MANPATH you will need to prepend /Applications/Xcode.app/Contents to these settings in your shell login script.
Where Did Instruments Go?
One other side-effect of this reorganisation is that you can now no longer navigate with the Finder under /Developer to access some of the additional developer tools such as Instruments. To get around this you can launch them from the Xcode > Open Developer Tool menu or alternatively you will also find them by right-clicking on the Xcode icon in the dock. Of course, you can use Options > Keep in Dock from the dock icon of the running application if you want to keep the icon handy in the dock for future access.