> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xenoci.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build

> box build builds your iOS app on a real Mac and sends the result back, with compile errors pointing at your own files

> [!NOTE]
>
> **When to use it.**
>
> * You or your agent changed Swift code and want to know it compiles, without a Mac or Xcode on your machine
> * You need an app for a real iPhone, built in Release and unsigned, to sign on your own computer
> * Your release script makes an IPA, and you want that IPA back

## Build for the simulator

From the root of the project (the folder with the `.xcodeproj`, `.xcworkspace`, `Package.swift` or XcodeGen `project.yml`)

```bash theme={"system"}
box build
```

<video controls muted loop playsInline autoPlay preload="metadata" poster="/media/docs/ios-build-poster.webp" src="https://mintcdn.com/xenoci/ZFKGlbE4Q2bw14Om/media/docs/ios-build.mp4?fit=max&auto=format&n=ZFKGlbE4Q2bw14Om&q=85&s=9f26c5fc162dc9fdaf13454702ccffee" width="1280" height="778" />

box build sending the project and building it for the iOS simulator

XenoCI Box uploads only the files that changed, builds on the Mac and streams one line per step

```text theme={"system"}
box: upload: 4 files checked, 4 new (3 KB), .gitignore respected, .env never sent (snapshot snap_qRcPvBjI2nTNdITg)
box: queue: job bj_IT3ANGI6EQ0D6NpQ (build, ios, $0.05/min) submitted
box: status: running
box: machine: source unpacked
box: cache: first build of this project on its disk, so everything is built once
box: build: xcodebuild build
** BUILD SUCCEEDED **
box: build: done in 6s
box: status: succeeded
box: results: saved to ./.box/out/bj_IT3ANGI6EQ0D6NpQ/ (build.log)
box: bj_IT3ANGI6EQ0D6NpQ succeeded, 60s billed, $0.05
```

> [!NOTE]
>
> Job `bj_IT3ANGI6EQ0D6NpQ` on the production Mac: 60 s billed, \$0.05

The whole log is in `.box/out/<job>/build.log`. When the build fails, each compile error comes as `file:line:col` with your local path and the lines around it, and box exits with 1. Add `--scheme`, `--configuration` or `--workspace` when the project has more than one

A `.box/setup` script at the project root runs on the build machine before `box build`, `box test` and `box run`, once until its contents change. If it fails, the build does not start. Put framework downloads and `.xcconfig` copies there; it is not a place for secrets, and `.env` is never uploaded. `box build --dry-run` lists what would be sent and says whether it would run

Each job prints one line per step, from your source to the results

**1. Upload**

box checks every file and sends only the new or changed ones. `.gitignore` is respected and `.env` is never sent

`box: upload: 70 files checked, 3 new (12 KB), .gitignore respected, .env never sent`

**2. Mac**

The job waits for a free Mac (not billed), which unpacks your source next to the project's previous build

`box: machine: source unpacked`

**3. Build**

xcodebuild compiles only what changed since that build

`box: build: done in 41s`

**4. Test**

Your tests run on a simulator and are counted

`box: tests 3 passed, 0 failed`

**5. Results**

Logs, the result bundle and screenshots come back to `.box/out/<job>/`, and the last line says what it cost

`box: bj_… succeeded, 120s billed, $0.10`

## Build for a device

```bash theme={"system"}
box build --device-build
```

An unsigned Release build for a real iPhone, saved as `device-build.zip` with the app inside `Payload/`. Sign it on your own computer; box keeps no certificates or profiles

```text theme={"system"}
box: build: xcodebuild build for a device (Release, unsigned)
** BUILD SUCCEEDED **
[box] 18:51:46 device build: box-out/device-build.zip (Payload/BoxDemo.app, unsigned)
box: build: done in 4s
box: status: succeeded
box: results: saved to ./.box/out/bj_uhnY5KdXm3RW3HOv/ (build.log, device-build.zip)
box: bj_uhnY5KdXm3RW3HOv succeeded, 60s billed, $0.05
```

> [!NOTE]
>
> Job `bj_uhnY5KdXm3RW3HOv` on the production Mac: 60 s billed, \$0.05

## Get an IPA back

box has no IPA command of its own. Run your own archive script with [`box exec`](https://docs.xenoci.com/ios/exec) and copy the IPA into `$BOX_OUT`; it comes back to `.box/out/<job>/`. The example on the [Exec](https://docs.xenoci.com/ios/exec.md) page does exactly this

## Next

* [Test](https://docs.xenoci.com/ios/test.md): build and run your tests on a fresh simulator
* [Why it failed](https://docs.xenoci.com/ios/why.md): where to read a failure first


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.