Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Building From the Command Line

In addition to building your product from within the Xcode application, you can use xcodebuild to build a target from the command line. Building from the command line gives you additional flexibility compared to building from within the Xcode application that may be useful in certain circumstances. For example, using the xcodebuild tool, you can create a script that automatically builds your product at a specific time or build targets from multiple projects at the same time.

Note: If you need root privileges to install a product in its deployment location, you must build the product with the xcodebuild tool, because Xcode cannot grant you these privileges.

The xcodebuild tool reads your .xcode project bundle and uses the target information it finds there to build a product. However, there are differences between building within Xcode and building from the command line:

To build a target using xcodebuild, use the cd command to change to your project’s directory and enter the xcodebuild command with any command-line options you wish to specify. The project’s directory contains your project’s .xcode bundle. For example, if your project is in ~me/Projects/MyProj, enter cd ~me/Projects/MyProj.

You can use xcodebuild to build a product suited for deployment and install the product in its final destination path. To do that, use the xcodebuild tool with the install option, which places the product in the distribution root specified by the DSTROOT, Installation Path (INSTALL_PATH), and Deployment Location (DEPLOYMENT_LOCATION) build settings. For example, to install a framework in /Library/Frameworks, configure the build settings as shown in Table 27-1.

Table 27-1  Build settings for installing a framework in the local domain

Build setting name

Value

DSTROOT

/

INSTALL_PATH

$(LOCAL_LIBRARY_DIR)/Frameworks

DEPLOYMENT_LOCATION

YES

The DSTROOT build setting can be set only in the xcodebuild command-line specification:

% sudo xcodebuild install -buildstyle Deployment DSTROOT=/ INSTALL_PATH=/Library/Frameworks  DEPLOYMENT_LOCATION=YES

See the xcodebuild man page for information on the available options and command usage. For details on framework placement, see Mac OS X Frameworks.



< Previous PageNext Page > Hide TOC


Last updated: 2006-11-07




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice