- STAFF PICKS
- GIFTS + GIFT CARDS
- SELL BOOKS
- FIND A STORE
Used Trade Paper
Ships in 1 to 3 days
More copies of this ISBN
Other titles in the Unleashed series:
Xcode 3 Unleashed (Unleashed)by Fritz Anderson
IN THIS INTRODUCTION
From the moment it first published Mac OS X, Apple, Inc., has made a complete suite of application development tools available to every user of the Macintosh. Since Mac OS X version 10.3, those tools have been led by Xcode, the integrated development environment Apple's own engineers use to develop system software and applications such as Safari, iTunes, Mail, and iChat. If you own a Mac, these same tools are in your hands today.
What's New in Xcode 3
In October 2007, with the introduction of Mac OS X 10.5 (Leopard), Apple introduced version 3 of the Xcode developer tools suite. Among the changes were
Xcode 3 is a ground-up rebuild of the Mac OS X developer tools, and it has been well worth the wait.
If you have an installation DVD for Mac OS X 10.5 or a new Mac on which Leopard has come installed, you already have Xcode. On the DVD, an installation package can be found in the Xcode Tools folder inside the Optional Installs folder. On new Macs, you'll find a disk image file for Xcode Tools in the Additional Installations folder at the root of your hard drive; double-click the disk image to mount it, and you'll find the installation packages inside.
However, Apple does not always coordinate the latest version of its developer tools with its Mac OS X distributions. Even if you have an installation package on your Mac, or on your distribution disk, it pays to check for a newer version at the Apple Developer Connection (ADC).
You must join ADC to download Xcode. Point your web browser to http://developer.apple.com/, and click the link that offers a membership (at the time of this writing, it was the Sign Up link at the top of the page). You will be offered a handful of options, some expensive. All you need is an Online membership—it's free. Fill out the forms offered to you; they will take contact information and ask you to consent to terms and conditions. There may be marketing questions and offers of mailings.
When you have completed the signup process, go to http://connect.apple.com. Fill in the username and password you chose. You will then be presented with a few options, among these being Downloads. This is what you want; click it.
Depending on your membership level, and how active Apple has been lately in releasing new software, you might not be able to find Xcode on this page. If you don't see it, click Developer Tools in the Downloads column at the right of the page. Scroll down to the first Xcode 3.x download you find (earlier releases may appear lower in the list, and versions of Xcode 2.5 may appear higher). It will be a disk image a bit over 1GB in size. This will comprise the full set of Xcode tools; there is no updater you can apply to a copy you may already have. Click to download.
Now that you have the latest Xcode package, it's time to install it. Installation packages can be run straight from a DVD, a mounted disk image file, or your hard disk. There's no difference.
In the Xcode Tools folder, you will find three installation packages:
You will also find a folder named Packages, containing installation packages for components of the Xcode tools, like the CHUD performance-measuring suite, software development kits (SDKs) for X Window and earlier versions of Mac OS X, and version 3.3 of the gcc compiler suite (for PowerPC Macs only). All these are available as options (or within options) in the Xcode Tools Installer, but are here in case you omit them from the original installation and want to add them later.
If you've ever done an installation under Mac OS X, the Xcode tools install is familiar (see Figure I.1). Start by double-clicking the XcodeTools.mpkg installation package. A Welcome screen appears, at which you will press Continue. Next, the installer displays the license for Xcode and its related software; click Continue, and if you accede to the license, click Agree in the ensuing sheet.
Figure I.1 The Welcome panel for the Xcode Tools Installation package should be familiar to any experienced Mac user.
You are now at the Standard Install panel, but we will vary from the standard line. Click the Customize button to reveal the Custom Install panel. This panel (see Figure I.2) contains a table listing the components of the Xcode Tools installation. The single mandatory component is checked and grayed out; the optional components are active, and you can check or uncheck them to include or exclude them from the installation:
Figure I.2 The Custom Install panel for the Xcode Tools Installer. The top entry in the package list is for the core Xcode tools, and is not optional. In the Location column is a pop-up menu from which you can select where the developer tools are to go; the default is the Developer folder of your boot disk.
Unlike earlier versions, Xcode 3 and 2.5 are flexible about where you install them. This is where you would make that choice. See the section "Another Install Location" for details.
Now click the Install button. The standard authentication sheet will appear, into which you enter the name and password of an administrative user of your Mac.
The next panel contains a progress bar and a narrative of what is being installed. This process takes a number of minutes, at the end of which you are rewarded by a big green check mark. Close the installer; you are now ready to use Xcode.
Another Install Location
Earlier versions of Xcode (earlier than 2.5) installed themselves only in the /Developer directory of the startup file system. Having one possible path to all the developer tools greatly simplified the task of locating them: If you needed the packagemaker tool, it was at /Developer/Tools/packagemaker, and that was that.
Things have changed since then. First, the Xcode package has grown larger and larger. The download package alone is 1.1GB in size, which expands to 3.3GB installed. It is reasonable to want to put Xcode onto another disk or partition. Second, it is now possible to install Xcode 2.5 (see the section "Xcode 2.5" that follows) in parallel with Xcode 3, and the two tool sets necessarily need two homes.
That is why, during your installation of Xcode, /Developer is still the default location, but you can choose another.
If you want another location, ignore the Change Install Location button on the Standard Install panel. The Installer application offers this button as a standard part of its workflow; if you press it, you will find that the boot volume is your only choice. If you find yourself at the Install-Location panel, click the Go Back button to back out.
The real choice comes in the Custom Install panel. In the Standard Install panel, click the Customize button to get to a list of components to install. The top line, Developer Tools Essentials, has a pop-up menu for setting the location for installing the Xcode tools (see Figure I.2). The default location, /Developer, is shown initially.
Change the location by selecting Other from the pop-up. A standard open-file sheet will appear. Find the directory that you want to contain your Xcode directory. Use the New Folder button to create the Xcode directory there. Make sure that directory is selected, and then click Choose. The selected directory will contain the Applications, Documentation, and other directories that make up the Xcode tool set.
You can continue the installation from there, as before.
All things come to an end, and there is no exception for Xcode. There are two reasons you might choose to remove Xcode from your hard drive. The first is that you just do not want it; you want the files gone, and the space reclaimed.
The second is that you want to install a later version of Xcode. When Apple comes out with new versions of Xcode, it does not distribute updaters. Only the full Xcode tools package will be available for download. Past experience has shown that a full upgrader is a bigger and more accident-prone undertaking than the Xcode team can sustain, especially when the alternative is to have Xcode users simply remove the earlier version and install the new version afresh.
The developer tools come in two parts. The most prominent is the /Developer directory itself, which contains all the graphical applications, documentation, and SDKs that make up the public face of Xcode. The other part is the tools embedded throughout the UNIX file system that make development possible. For instance, two versions of the gcc compiler are installed at /usr/bin; all the headers needed for development on the current system are in the huge /usr/include hierarchy. To properly uninstall the developer tools, these, too, have to be picked through and removed.
The first part of the uninstallation is easy: Find your Xcode tools directory, and drag it into the trash. That's 100,000-plus files gone.
Next, execute the tool /Library/Developer/Shared/uninstall-devtools from the command line. uninstall-devtools is a Perl script that walks through the saved installation receipts looking for every developer tools package going back to 2001. It deletes the files of every package it finds. Running uninstall-devtools will take a few minutes. At the end, you have a system fit for a fresh install.
This procedure is good enough if you mean to reinstall the developer tools. If you mean to go further, you also want to delete the directories /Library/Developer and ~/Library/Developer, and the preference files for the individual developer applications. The usual procedure spares these, because they contain customization files you may have created, which you would want to carry over to a new installation.
Many people have commitments to Xcode 2 that they can't get out of, even if they are running Leopard. Managers of a project nearing completion, with many developers, may be reluctant to revalidate their build processes for a new tool chain.
They might have NIBs that rely on palettes for Interface Builder 2, which are not usable in IB 3. Further, although Xcode and Interface Builder do provide "compatibility" modes, it is easy to produce files that earlier versions cannot open. Holding off on Xcode 3, at least for some projects, can be prudent.
That is why Apple released, in parallel with Xcode 3, Xcode 2.5. The Xcode 2.5 tools are strictly file compatible with those of the preceding version, Xcode 2.4. Unlike version 2.4, 2.5 can run on either Tiger (Mac OS X 10.4) or Leopard (10.5).
Like Xcode 3, Xcode 2.5 permits you to choose where to install its developer tools. As with the Xcode 3 installation, you are offered a Customize button for editing the components to be installed. The top component, representing the core developer tools, will have a pop-up enabling you to chose where to install Xcode 2.5. The default location is /Xcode2.5.
If you intend to develop specifically for Mac OS X 10.5, Xcode 2.5 is not for you; it does not support the Leopard SDK. For Leopard development, you have to use Xcode 3.
If you have Project Builder (.pbxproj) projects around, now is the time to convert them to Xcode projects, and 2.5 is the tool to do it. Xcode 3 has dropped the capability to import Project Builder projects.
Having two Xcodes on your system gives you two versions of Xcode-related command-line tools such as xcodebuild. If you opt (as I strongly recommend) to install tools in /usr/bin, it is a nice question which version of a tool is run when you execute it from the command line or a build script. The solution is this: The /usr/bin versions of these tools are in fact scripts that refer to the binary versions in the Xcode 3 or 2.5 install tree. You determine which version is used by running the xcode-select tool; man xcode-select for details.
© Copyright Pearson Education. All rights reserved.
What Our Readers Are Saying
Business » Human Resource Management