Build an Xcode Project from the Terminal with xcodebuild
Compile an app by scheme and configuration without launching Xcode.
Run xcodebuild -project MyApp.xcodeproj -scheme MyApp -configuration Debug build to compile from the command line.
01Command
Command
$ xcodebuild -project MyApp.xcodeproj -scheme MyApp -configuration Debug build02What it does
xcodebuild drives the same build system Xcode's IDE uses, which makes it the backbone of CI pipelines and scripted builds. List the available schemes first with xcodebuild -list, since the -scheme name must match exactly. Output lands in the DerivedData folder; add -showBuildSettings or -derivedDataPath to control where things go.
03Risk
!Warning: A workspace (-workspace X.xcworkspace) must be used instead of -project when the project has CocoaPods dependencies, or build errors follow. Code signing failures are common outside the IDE — add CODE_SIGNING_ALLOWED=NO for a quick local test build.
04Undo
Undo
$ xcodebuild -project MyApp.xcodeproj -scheme MyApp clean05Sources
- xcodebuild(1) macOS Manual PageEvidence: Documents xcodebuild -project/-scheme/-configuration and the build and clean actions.
Last verified: 2026-09-18 · Category: Developer