Lập trình Wrox Professional Xcode 3 cho Mac OS part 1 potx

8 322 0
Lập trình Wrox Professional Xcode 3 cho Mac OS part 1 potx

Đang tải... (xem toàn văn)

Thông tin tài liệu

1 Installing Xcode WHAT'S IN THIS CHAPTER? Installing the Xcode Developer Tools Choosing the install location and packages Upgrading Xcode Removing Xcode Xcode is part of the Xcode Developer Tools suite developed and distributed by Apple. If you haven ’ t installed it already, read this chapter to fi nd out how to do so. If the tools are already installed, you can skip to the next chapter. If you ’ ve already installed Xcode, be aware that the default installation choices do not include all Xcode components. Features described in some chapters may require you to reinstall the omitted packages before you can use them. Return to this chapter to reinstall, upgrade, or remove the Xcode Developer Tools in your system. The Xcode Developer Tools encompass a huge amount of material: dozens of applications, scores of utilities, hundreds of sample projects, and thousands of pages of documentations. Despite its scope, the developer tools team at Apple has made it remarkably easy to install this wealth of tools in only a few minutes. ➤ ➤ ➤ ➤ c01.indd 1c01.indd 1 1/7/10 11:33:47 AM1/7/10 11:33:47 AM Download at getcoolebook.com 2 ❘ CHAPTER 1 INSTALLING XCODE THE XCODE INSTALLER To install the Xcode Developer Tools, you must be running Mac OS X and have access to an Xcode Developer Tools installer. At the time this book was published, the current version of Xcode was 3.2, which requires that you be running Mac OS X 10.6 (aka Snow Leopard) or later. This entire book was written with, and assumes you are using, Xcode version 3.2 or later. Although the tools require Mac OS X 10.6 or later to run, you can develop code that ’ s compatible with systems as old as Mac OS X 10.4. Some development packages, like the iPhone SDK, may have additional hardware or operating system requirements. The Xcode Developer Tools installer is available from many sources. Many fl avors of the Mac OS X operating system installer include a copy of the Xcode Development Tools. Updated versions are occasionally included in the monthly Apple Developer Connection (ADC) DVD for download. First check to see whether you have a recent version of the Xcode developer tools already. The latest version of the Xcode Developer Tools can always be downloaded from the Apple Developers Connection at http://developer.apple.com/ . Anyone with an ADC account can download the latest development tools, software development kits, and example code directly from Apple. Online ADC accounts are free and require only that you create an ADC account and agree to the nondisclosure agreement that covers all Apple development technologies. Student, Select, and Premier accounts can be purchased and include many additional benefi ts. One of these is the monthly ADC mailing, mentioned earlier, which includes regular updates to tools and reference material. Other perks include discounts on hardware used for development and direct access to Apple engineers for technical questions. If you are serious about developing software for Mac OS X or the iPhone OS, you should invest in a paid membership. If you plan to sell your iPhone applications through Apple ’ s App Store, you must have a paid iPhone developer account. Apple has never made incremental updaters for Xcode. Every version of Xcode ever released has included a complete copy of the entire suite. As such, there is nothing to be gained by installing an earlier version of Xcode and then upgrading it to a later version. Just install the latest version. As of this writing, the Xcode developer tools installer is available in two forms. The Xcode download from the Mac Dev Center includes Xcode and all of the resources needed to develop applications for Mac OS X. The iPhone SDK from the iPhone Dev Center includes the entire Mac OS X suite plus additional tools and frameworks for developing iPhone applications. Installing using the vanilla Xcode download enables you to develop applications for Mac OS X. Installing the iPhone SDK enables you develop both Mac OS X applications and iPhone applications. c01.indd 2c01.indd 2 1/7/10 11:33:56 AM1/7/10 11:33:56 AM Download at getcoolebook.com RUNNING THE INSTALLER To start the installation process, open the XcodeTools or iPhone SDK package. You can fi nd the XcodeTools package in the Optional Installs folder of the Mac OS X install DVD, as shown on the left in Figure 1 - 1. The iPhone SDK package is in the iPhone SDK disk image, as shown on the right in Figure 1 - 1. Opening the package launches the installer utility. FIGURE 1-1 The installer presents a greeting screen. Click the Continue button. It next presents the software licensing agreement that accompanies the use of the developer tools provided by Apple, and possibly additional licensing agreements for iPhone and other SDKs. The pop - up menu at the top of the window may allow you to read the licensing agreement in other languages. Review the document using the scroll bar. If you like, you can print or save the agreement for review or for your records by clicking the Print or Save button. After you click the Continue button, a dialog box asks you to confi rm that you agree to the terms of the license. Click the Agree button. If this is your fi rst installation, the installer may prompt you to choose the volume to install. Choose your startup volume. The Custom Install screen, shown in Figure 1 - 2, selects the packages you want installed and where. By default, the bulk of the Xcode package is installed in the /Developer folder of the startup volume. Unless you have a compelling reason to change the installation location, accept the default /Developer folder. Running the Installer ❘ 3 c01.indd 3c01.indd 3 1/7/10 11:34:07 AM1/7/10 11:34:07 AM Download at getcoolebook.com 4 ❘ CHAPTER 1 INSTALLING XCODE Beginning with Xcode 3.1, the Xcode tools, documentation, and frameworks can be installed in an alternate location, allowing you to install several different versions of Xcode simultaneously. For example, you may need to keep a copy of Xcode 2.2 or 3.0 in order to maintain legacy projects. To install Xcode in an alternate location, select the pop - up button in the location column and choose a different volume or folder: /Xcode3.1 , for example. Note that the UNIX Developer Support package is always installed in the /usr/bin directory, and WebObjects is always installed in /Developer . The installer will present a default set of packages to install. Alter the set of installation packages by checking, or unchecking, each one in the list. Select a package to display a brief description of its contents. The following table explains the contents and usefulness of the various Xcode Developer Tools packages. FIGURE 1-2 PACKAGE DESCRIPTION Developer Tools Essentials This package contains the core set of development tools, including the Xcode IDE and all of the Mac OS X SDKs. You must install this package. iPhone SDK Includes the compilers, header fi les, libraries, frameworks, documentation, and emulation tools used to develop iPhone applications. c01.indd 4c01.indd 4 1/7/10 11:34:08 AM1/7/10 11:34:08 AM Download at getcoolebook.com PACKAGE DESCRIPTION System Tools Installs standalone system analysis tools such as Shark and DTrace components. These can be used independently or from within the Xcode IDE. You should install this package. UNIX Development Support Installs a set of compilers and other command-line tools in the /usr/bin directory. Note that these are duplicates of the compilers installed by the Developer Tools Essentials. Install this package if you intend to write shell scripts that perform builds or use makefi les that expect UNIX development tools to be in their traditional location. Mac OS X 10.4 Support Installs the compilers and SDKs compatible with Mac OS X 10.4. Install this only if you must produce code that runs on Mac OS X 10.4. After you choose what you want to install, click the Continue button to start the installation process, shown in Figure 1 - 3. You will have to supply the account name and password of an administrator when asked. FIGURE 1-3 The bulk of the installation occurs in the /Developer folder, or whatever alternate location you chose, shown in Figure 1 - 4. Here you will fi nd all of the Xcode applications, command - line tools, example code, and documentation. I recommend that you add the Xcode IDE application to your dock now. Running the Installer ❘ 5 c01.indd 5c01.indd 5 1/7/10 11:34:08 AM1/7/10 11:34:08 AM Download at getcoolebook.com 6 ❘ CHAPTER 1 INSTALLING XCODE Do not attempt to move or rename this folder or any of its contents. The installer places support fi les in the system - wide /Library/Application Support folder. It installs some special development frameworks, resources, and a few patches into the /System folder. UNIX tools and man pages are installed in the /usr folder. After the installer is fi nished, check out any “ About ” documents installed for an overview of the developers tools and for any late - breaking news, additions, or corrections. Congratulations, you ’ ve installed Xcode! If you like, you can now skip to Chapter 2. UPGRADING XCODE If you already have an older version of Xcode installed, you ’ ll fi nd some subtle differences when you run the installer again. The installer automatically detects the version of any package that you have previously installed. The packages, shown in Figure 1 - 5, show which packages will be upgraded, installed, or skipped. An upgrade indicates that the installer has a newer version of the package to install. The size indicates the estimated amount of additional disk space required to upgrade the package. Skipped packages will not be upgraded or installed. If a package is disabled, Xcode has determined that the existing package does not need to be, or cannot be, upgraded. This is typically because you already have the most current, or a later, version installed. The Xcode installer will never “ downgrade ” a package by attempting to install an older version over a newer one. FIGURE 1-4 FIGURE 1-5 c01.indd 6c01.indd 6 1/7/10 11:34:09 AM1/7/10 11:34:09 AM Download at getcoolebook.com After you select the packages you want upgraded, click the Continue button. The installer runs much as it does when installing for the fi rst time. Typically you won ’ t have any problems using your upgraded tools as soon as the installer is fi nished. However, if you immediately start using some of the performance analysis tools or attempt distributed builds, you may run into problems. These facilities use daemons and system frameworks that may need to be reloaded. Restart your system after upgrading your Xcode tools. REMOVING AND REINSTALLING XCODE The Xcode Developer Tools provide the means for completely eradicating itself — the entire suite of tools, support fi les, libraries, and frameworks — from your system. One really good reason to do this is to perform a clean installation of the tools. Apple often makes pre - release versions of Xcode available to ADC members. As a general rule, you cannot install a release version over a pre - release version even when that release version is newer. You may also have some need to downgrade your installation, something the regular installation process won ’ t allow. To remove your installation of Xcode, open a Terminal window and enter the following command: sudo /Developer/Library/uninstall-devtools mode=all If you installed Xcode in a location other than /Developer , adjust the path accordingly. If this fi le is not present — earlier versions of Xcode used different scripts stored in different locations — refer to the “ About ” document for the currently installed version to fi nd the appropriate script. The script must be run from an administrator ’ s account. The sudo command prompts you for the password to that account. The script uses the receipts left by prior installations of Xcode to surgically remove everything that was previously installed. It also takes care of a few special cases, such as removing symbolic links that get created during the post - installation process. The - - mode argument has four possible values, listed in the following table. Removing and Reinstalling Xcode ❘ 7 MODE DESCRIPTION all Removes all tools and directories installed by Xcode. systemsupport Removes only the UNIX support fi les (utilities, man pages, and so on) from the startup volume. unixdev Removes the compilers and other command-line tools installed by the UNIX Development Support package, described in the previous table. xcodedir Removes only the /Developer folder, or its alternative parent location. Equivalent to dragging the /Developer folder to the trash. c01.indd 7c01.indd 7 1/7/10 11:34:09 AM1/7/10 11:34:09 AM Download at getcoolebook.com 8 ❘ CHAPTER 1 INSTALLING XCODE After the old copy of the developer tools is removed, you can reinstall whatever version of Xcode you want. The installer treats this as a new installation, installing fresh copies of everything. After you reinstall the tools, you may need to restart your system. The uninstall - devtools script stops processes like the distributed build daemon, but the installer may not restart them again. Removing system frameworks and then replacing them with altered versions can seriously confuse the operating system. Restarting your computer causes all of these resources to be reloaded, reinitialized, and restarted properly. SUMMARY You ’ re probably eager to start exploring Xcode, but installing the software fi rst is a necessary evil. As you ’ ve seen, the process is relatively painless and quick. Now, on to the grand tour. c01.indd 8c01.indd 8 1/7/10 11:34:10 AM1/7/10 11:34:10 AM Download at getcoolebook.com . Running the Installer ❘ 3 c 01. indd 3c 01. indd 3 1/ 7 /10 11 :34 :07 AM1/7 /10 11 :34 :07 AM Download at getcoolebook.com 4 ❘ CHAPTER 1 INSTALLING XCODE Beginning with Xcode 3. 1, the Xcode tools, documentation,. minutes. ➤ ➤ ➤ ➤ c 01. indd 1c 01. indd 1 1/7 /10 11 :33 :47 AM1/7 /10 11 :33 :47 AM Download at getcoolebook.com 2 ❘ CHAPTER 1 INSTALLING XCODE THE XCODE INSTALLER To install the Xcode Developer Tools,. Installing the iPhone SDK enables you develop both Mac OS X applications and iPhone applications. c 01. indd 2c 01. indd 2 1/ 7 /10 11 :33 :56 AM1/7 /10 11 :33 :56 AM Download at getcoolebook.com RUNNING THE

Ngày đăng: 04/07/2014, 06:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan