# Device scenes

> Device scenes in the Edith ed command line reference. The ed command line

- Canonical URL: https://getedith.pro/docs/cli/invoke/device-scenes
- Updated: 2026-12-02

[The `ed` command line](https://getedith.pro/docs/cli)

Use `ed invoke deviceScenes ACTION --json 'PAYLOAD'` to save and apply reusable
iOS Simulator scenes. Open the Device scenes page for the same preview flow.

| Action | Payload | Result |
| --- | --- | --- |
| `deviceScenes.state` | `{}` | Saved `scenes`, Xcode `inventory`, or an actionable `issue` when tools cannot be used. |
| `deviceScenes.save` | Scene object below | Saved scene with its `id`, replacing an existing scene with the same id. |
| `deviceScenes.remove` | `{"id":"SCENE_UUID"}` | `{}` after removing the saved scene. |
| `deviceScenes.preview` | Scene object | Preview `token`, requested `scene`, selected `device`, Xcode `inventory`, ordered `steps` and `notes`. |
| `deviceScenes.apply` | `{"token":"PREVIEW_UUID"}` | Scene, `completedSteps` and `linkAccepted`. |

First discover the exact device UUID:

```sh
ed invoke deviceScenes deviceScenes.state --json '{}'
```

A scene has these fields. Only `deviceID` is required: replace it with a UUID
from `inventory.devices`. A missing `id` gets a fresh UUID, which the save result
returns; pass it again to edit that scene. Missing `name` defaults to
`Onboarding`, missing `appearance` to `keep`, and missing `locale`, `bundleID`
and `link` to empty strings:

```json
{
  "id": "11111111-2222-3333-4444-555555555555",
  "name": "Onboarding in French",
  "deviceID": "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE",
  "appearance": "dark",
  "locale": "fr_FR",
  "bundleID": "com.example.demo",
  "link": "demo://onboarding?step=welcome"
}
```

The smallest scene is `{"deviceID":"AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE"}`.
Pass the object to `deviceScenes.save` to persist it, then to
`deviceScenes.preview` to review the requested state. Previewing an unsaved
scene is also supported. Only applying its returned token changes the device:

```sh
ed invoke deviceScenes deviceScenes.apply --timeout 240 --json '{"token":"PREVIEW_UUID"}'
```

Use `--timeout 180` for preview and `--timeout 240` for apply so device startup
can finish. The generic invoke timeout is 30 seconds by default.

Tokens expire after five minutes, can be used once, and belong to the running
extension. At most 16 previews are kept; a newer preview drops the oldest token.
Suspension or an extension restart invalidates them. Each token keeps the scene
it previewed, so saving, editing or removing scenes afterwards does not change
what it applies.
Apply rechecks the selected Xcode and device without rerunning the preview
checks. A changed device state requires another preview. If that recheck cannot
finish, for example because Xcode timed out, the token stays valid for a retry.
Additional scene fields are rejected with `unsupportedOption`. A payload that is
not a JSON object, a field with the wrong type, or an `id` or `token` that is not
a UUID is rejected with `invalidRequest`.

Only one apply runs at a time; a second apply fails with `busy` until the first
finishes. `state`, `save`, `remove` and `preview` keep working while an apply is
running.

`appearance` accepts `keep`, `light` or `dark`. Empty `locale`, `bundleID` and
`link` strings are allowed. A locale requires an installed app's bundle
identifier. It relaunches that app using `-AppleLanguages` and `-AppleLocale`,
without changing the Simulator's system language. Use a Foundation locale
identifier, such as `en_US`, `fr_FR` or `ja_JP`. The next normal app launch can
use its previous locale. An app bundle identifier alone does not launch the app.

Links must be complete URLs with encoded spaces and resolved parameters.
Custom schemes, HTTP and HTTPS links are accepted. File, script and data URLs
are rejected. The receiving app must already be installed and handle the URL.
Universal Link routing remains the app and operating system's responsibility;
an HTTP link may open Safari. `linkAccepted` records successful `simctl openurl`,
not an assertion that a particular app or onboarding screen appeared.

Missing Xcode, missing devices, unavailable runtimes, unsupported Xcode commands
and missing installed apps produce actionable failures. Failure messages name the
Xcode command and its error, or how long it ran before timing out. `state` still
returns saved scenes when Xcode is missing; inspect its `issue`, not just the CLI
exit status. Saving scenes does not require Xcode. At most 100 scenes are stored.

Device scenes uses the Xcode chosen with `xcode-select`. When that is the
Command Line Tools or another directory without Simulator tools, it uses the
first installed Xcode instead. `inventory.developerDirectory` shows the Xcode in
use.

A scene can boot a shutdown device. Preview does not boot it. A scene with
changes also opens that Xcode's Simulator app on the device, right after startup
for a shutdown device or first for a booted one, so the remaining steps are
visible. This step appears in `steps` with `"tool":"open"`; the other steps use
`"tool":"simctl"` and run through `xcrun simctl`. App installation
is checked on a booted device during preview and immediately before relaunching.
If a later step fails or the operation is cancelled, completed changes remain
applied. Refresh and preview again before retrying. Execution uses argument
arrays, and never interprets a link as a shell command.

## Get Edith

Edith is a native Mac app for macOS 14 or later on Apple silicon with 100+ extensions, the `ed` command line and an MCP server. $35 once for one Mac, plus $7 for each additional Mac, with no subscription and a 30-day refund.

- [Buy Edith](https://getedith.pro/pricing): $35 once for one Mac, plus $7 for each additional Mac
- [Download Edith](https://getedith.pro/download): the installer, or Homebrew
