xcodebuild(1) BSD General Commands Manual xcodebuild(1)
NAME
xcodebuild -- build Xcode projects and workspaces
SYNOPSIS
xcodebuild [-project projectname] [-target targetname ...] [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] [-userdefault=value ...] xcodebuild [-project projectname] -scheme schemename [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] [-userdefault=value ...] xcodebuild -workspace workspacename -scheme schemename [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] [-userdefault=value ...] xcodebuild -version [-sdk [sdkfullpath | sdkname]] [infoitem] xcodebuild -showsdks xcodebuild -list [-project projectname | -workspace workspacename]
DESCRIPTION
xcodebuild builds one or more targets contained in an Xcode project, or builds a scheme contained in an Xcode workspace or Xcode project. Usage To build an Xcode project, run xcodebuild from the directory containing your project (i.e. the directory containing the projectname.xcodeproj package). If you have multiple projects in the this directory you will need to use -project to indicate which project should be built. By default, xcodebuild builds the first target listed in the project, with the default build configuration. The order of the targets is a property of the project and is the same for all users of the project. To build an Xcode workspace, you must pass both the -workspace and -scheme options to define the build. The parameters of the scheme will control which targets are built and how they are built, although you may pass other options to xcodebuild to override some parameters of the scheme. There are also several parameters to display info about the installed version of Xcode or about projects or workspaces in the local directory, but which do not initiate a build. These include -version, -showsdks, and -usage. Options -project projectname Build the project specified by projectname. Required if there are multiple project files in the same directory. -target targetname Build the target specified by targetname. -alltargets Build all the targets in the specified project. -workspace workspacename Build the workspace specified by workspacename. -scheme schemename Build the scheme specified by schemename. Required if building a workspace. -configuration configurationname Use the build configuration specified by configurationname when building each target. -arch architecture Use the architecture specified by architecture when building each target. -sdk [<sdkfullpath> | <sdkname>] Build an Xcode project or workspace against the specified SDK, using build tools appropriate for that SDK. The argument may be an absolute path to an SDK, or the canonical name of an SDK. -showsdks Lists all available SDKs that Xcode knows about, including their canonical names suitable for use with -sdk. Does not initiate a build. -list Lists the targets and configurations in a project, or the schemes in a workspace. Does not initiate a build. buildaction ... Specify a build action (or actions) to perform on the target. Available build actions are: build Build the target in the build root (SYMROOT). This is the default build action. archive Archive a scheme from the build root (SYMROOT). This requires specifying a scheme. test Test a scheme from the build root (SYMROOT). This requires specifying a scheme. installsrc Copy the source of the project to the source root (SRCROOT). install Build the target and install it into the target's installation directory in the distribution root (DSTROOT). clean Remove build products and intermediate files from the build root (SYMROOT). -xcconfig filename Load the build settings defined in filename when building all tar- gets. These settings will override all other settings, including settings passed individually on the command line. setting=value Set the build setting setting to value. -userdefault=value Set the user default default to value. -version Display version information for this install of Xcode. Does not initiate a build. When used in conjunction with -sdk, the version of the specified SDK is displayed, or all SDKs if -sdk is given no argument. Additionally, a single line of the reported version information may be returned if infoitem is specified. -usage Displays usage information for xcodebuild. Environment Variables The following environment variables affect the execution of xcodebuild: XCODE_XCCONFIG_FILE Set to a path to a file, build settings in that file will be loaded and used when building all targets. These set- tings will override all other settings, including set- tings passed individually on the command line, and those in the file passed with the -xcconfig option. Exit Codes xcodebuild exits with codes defined by sysexits(3). It will exit with EX_OK on success. On failure, it will commonly exit with EX_USAGE if any options appear malformed, EX_NOINPUT if any input files cannot be found, EX_IOERR if any files cannot be read or written, and EX_SOFTWARE if the commands given to xcodebuild fail. It may exit with other codes in less common scenarios.
EXAMPLES
xcodebuild clean install Cleans the build directory; then builds and installs the first target in the Xcode project in the directory from which xcodebuild was started. xcodebuild -target MyTarget OBJROOT=/Build/MyProj/Obj.root SYMROOT=/Build/MyProj/Sym.root Builds the target MyTarget in the Xcode project in the directory from which xcodebuild was started, putting intermediate files in the directory /Build/MyProj/Obj.root and the products of the build in the directory /Build/MyProj/Sym.root. xcodebuild -sdk macosx10.6 Builds the Xcode project in the directory from which xcodebuild was started against the Mac OS X 10.6 SDK. The canonical names of all available SDKs can be viewed using the -showsdks option. xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme Builds the scheme MyScheme in the Xcode workspace MyWorkspace.xcworkspace. xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme archive Archives the scheme MyScheme in the Xcode workspace MyWorkspace.xcworkspace. xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme test Tests the scheme MyScheme in the Xcode workspace MyWorkspace.xcworkspace.
SEE ALSO
sysexits(3) Mac OS X June 29, 2011 Mac OS X
Mac OS X 10.8 - Generated Mon Aug 20 16:28:08 CDT 2012