# Physical Apple device operations

Use Lavender as the control plane. Tailscale does not replace Xcode/CoreDevice pairing.

## Preflight

1. Discover live identities:

   ```sh
   xcrun devicectl list devices
   xcrun xctrace list devices
   ```

2. Match `indigo` or `kellcd` to a live identifier from the current output. Avoid persisting a stale identifier when the device name is sufficient.
3. Confirm the device is awake, unlocked, paired, trusted, in Developer Mode, and reachable by USB or Apple's paired wireless path.
4. Inspect the repo's documented mobile workflow, package scripts, workspace/project, schemes, bundle identifier, and signing team before inventing commands.

Complete preflight when the intended physical device is `available` and the project exposes a buildable scheme or documented Expo path.

## Native Xcode path

Discover schemes and destinations first:

```sh
xcodebuild -list -workspace <App.xcworkspace>
xcodebuild -showdestinations -workspace <App.xcworkspace> -scheme <Scheme>
```

Build or test against the live identifier:

```sh
xcodebuild build -workspace <App.xcworkspace> -scheme <Scheme> -destination 'platform=iOS,id=<live-id>'
xcodebuild test -workspace <App.xcworkspace> -scheme <Scheme> -destination 'platform=iOS,id=<live-id>'
```

Use the locally installed `devicectl` syntax as the authority before install or launch:

```sh
xcrun devicectl help device install app
xcrun devicectl help device process launch
xcrun devicectl device install app --device <live-id> <App.app>
xcrun devicectl device process launch --device <live-id> <bundle-id>
```

## Expo path

Prefer the repo's package manager and scripts. Inspect the installed CLI before selecting the physical device:

```sh
npx expo run:ios --help
```

Target `indigo` or `kellcd` by the syntax supported by that repo's installed Expo version. Keep Metro reachable from the device; use the tailnet address only when the app or dev server is intentionally configured for it.

## Verification

Verify installation, launch, and the requested behavior on the named physical device. Capture only relevant console output or diagnostics; redact tokens, personal content, notification payloads, and unrelated device logs.
