Index of every page on this site: llms.txt
All skills
kimeur avatar

/duo-setup

@cffd95d
by Gazouzi Marouanekimeur/duology46 stars
2
Run it yourself

Sets up a Mac to build, run and test apps for iPhone Duo, the foldable iPhone with an outer display and an inner display, covering Xcode 27.1 next to an older Xcode with DEVELOPER_DIR (no sudo xcode-select), xcodebuild -version, the iOS 27.1 SDK and runtime, the iPhone Duo simulator in Device Hub (xcrun simctl create/bootstatus, a screenshot of each display, the Closed / Partially Open / Open poses and the fold angle), Xcode's MCP server for Claude Code (xcrun mcpbridge, MCP_XCODE_PID, xcrun agent skills export) and project settings (IPHONEOS_DEPLOYMENT_TARGET, SWIFT_VERSION 6, SWIFT_DEFAULT_ACTOR_ISOLATION MainActor, SWIFT_APPROACHABLE_CONCURRENCY, synchronized folders). Use it when the Mac or project isn't ready for iPhone Duo work (duo-start or /duo-doctor sends you here), when /duo-doctor fails, when xcodebuild picks the wrong Xcode, when the Duo simulator, iOS 27.1 runtime or hinge pose is missing, or when Claude Code can't reach Xcode.

Use this Skill: https://skilld.dev/gh/kimeur/duology/duo-setup

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencessimulator-and-device-hub.md

≈3.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

The iPhone Duo simulator and Device Hub

Everything an agent can do with the iPhone Duo simulator from the shell, and what only the user can do in Device Hub.

Checked on 16 October 2026 with Xcode 27.1 (27A9275) and the iOS 27.1 runtime (24A94425). Every command on this page ran on that Mac unless the text says otherwise. Put DEVELOPER_DIR=/Applications/Xcode-27.1.app/Contents/Developer in front of each xcrun call below. An agent's shell may not keep an export from an earlier call; export it only in an interactive terminal.

Find the device

xcrun simctl list devicetypes | grep "iPhone Duo"
# iPhone Duo (com.apple.CoreSimulator.SimDeviceType.iPhone-Duo)
xcrun simctl list runtimes | grep "iOS 27"
xcrun simctl list devices available | grep "iPhone Duo"
# iPhone Duo (9F89DDE7-...) (Booted)

For scripts, read the JSON form. This prints the UDID of each "iPhone Duo" on the iOS 27.1 runtime:

xcrun simctl list --json devices available | python3 -I -c 'import json,sys; d=json.load(sys.stdin)["devices"]; print("\n".join(x["udid"] for k,v in d.items() if k.endswith("iOS-27-1") for x in v if x["name"]=="iPhone Duo"))'

The Duo device type needs the iOS 27.1 runtime or later. Simulators are shared by every Xcode on the Mac: Xcode 26.5's simctl lists the same Duo device.

Create, boot, delete

Reuse the iPhone Duo simulator the Mac already has. Create one only when list shows none, and only after the user agrees. Each simulator takes about 4-6 GB of disk once it has booted (measured on 18 October 2026: 3.9 GB for a Duo simulator in use). Never create a second one for tests, and never clone one. Pass -parallel-testing-enabled NO to xcodebuild test, or it may clone the simulator for you.

# create (ask the user first, and say it takes about 4-6 GB): prints the new UDID; the runtime is optional (newest compatible if left out)
xcrun simctl create "iPhone Duo" com.apple.CoreSimulator.SimDeviceType.iPhone-Duo com.apple.CoreSimulator.SimRuntime.iOS-27-1

# boot if needed, then wait until it is ready
xcrun simctl bootstatus <UDID or name> -b

# delete a simulator you created, by its UDID; never one you didn't create
xcrun simctl delete <UDID>
  • bootstatus -b on a booted device prints "Device already booted, nothing to do." It usually returns in about a second. Once it took many minutes on a busy Mac, so agents should run it in the background and poll.
  • xcrun simctl boot on a booted device fails: code 405, "Unable to boot device in current state: Booted", exit 149. Treat that as success.
  • Pass a UDID, not a name, when two devices share a name.
  • Several agents or terminals may share one booted simulator. Don't shut it down, erase it or change its settings unless you started it. booted picks any booted device when more than one runs.

Device Hub

Xcode 27.1 runs simulators in Device Hub. It ships DeviceHub.app and no Simulator.app.

open /Applications/Xcode-27.1.app/Contents/Applications/DeviceHub.app

Use the full path. "$DEVELOPER_DIR/..." turns into /../Applications/... when the variable isn't set, and a DEVELOPER_DIR=... open prefix doesn't help, because the shell expands the path before it sets the variable.

Or, in Xcode, choose Manage Devices from the run destination menu, or Xcode > Open Developer Tool > Device Hub. Running an app on a simulator opens a compact Device Hub window; expand it to see the sidebar, canvas and inspector. The sidebar lists only simulators you added or used as run destinations; add one with the + button (Apple: managing devices, Apple: Device Hub).

Poses: only in Device Hub

xcrun simctl help and xcrun devicectl help device in Xcode 27.1 list no pose, hinge or fold subcommand. The pose controls sit under the bezel in Device Hub (Apple: interacting in Device Hub):

  • Closed: the button to the right of Rotate Right. The app moves to the outer display.
  • Partially Open: the middle of the three pose buttons. The fold becomes a division region.
  • Open: the button on the far right. The app fills the inner display.
  • Any angle: hold Option and drag the slider that appears below the bezel.
  • Rotate: the rotate button (Option-click rotates right), or Device > Orientation.

Words like "book" or "tabletop" are not Apple names. Apple's controls say Closed, Partially Open and Open. In code, the hinge status is closed, partiallyOpen or fullyOpen (see reference/device-facts.md).

simctl io <device> screenConfig can power a screen off or change its geometry. It is not a pose control. We tried power on on the inner display: its backlight came on, but it stayed inactive and the outer display stayed active. Don't use it to fake a pose.

When a task needs several poses, list them for the user, ask them to click each one, and take a screenshot after each click.

Script the pose buttons

A small Mac program can press Device Hub's pose buttons through the macOS Accessibility API. We set all four poses this way with no one at the keyboard (Xcode 27.1, macOS 27.0.1, 17 and 18 October 2026). duo-pose-matrix (duology-ship, v0.2) ships this as duo-pose and duo-pose-matrix. Still ask the user to press the pose by default, unless they ask you to script it.

How it works:

  1. Device Hub is open, with the iPhone Duo selected. Get its process ID with pgrep -x DeviceHub.
  2. Check trust without a prompt: call AXIsProcessTrustedWithOptions with kAXTrustedCheckOptionPrompt set to false. If it returns false, stop and ask the user to press the button.
  3. Walk the accessibility tree from AXUIElementCreateApplication(pid). Find the AXButton whose description (kAXDescriptionAttribute) is Closed, Partially Open, Open or Rotate Right. The pose buttons have no identifier.
  4. Call AXUIElementPerformAction(button, kAXPressAction). Then wait: Open and Partially Open settled in 4 to 6 seconds. Closed once took between 5 and 9.
Pose Press
Closed Closed
Open Open
Partly folded like a book Partially Open
Partly folded across (tabletop) Partially Open, then Rotate Right once. Three more Rotate Right presses bring it back to portrait.

Limits:

  • It needs Accessibility permission for the app that runs you (Terminal, iTerm, the Claude app). Only the user can give it, in System Settings > Privacy & Security > Accessibility. Never try to change it.
  • It is UI scripting. It drives Device Hub's window, depends on its English labels and its layout, and can break in any Xcode update. When the buttons aren't found, fall back to asking the user.
  • The pose belongs to the whole simulator. On a shared simulator it changes the screen for every agent and UI test using it. Check that nothing else is running first, and leave the simulator Closed, in portrait, when you finish.
  • Device Hub doesn't report the pose. Its sidebar image still said Closed after we pressed Open. xcrun devicectl device info displays -d <UDID> marks the active display: LCD when closed, LCD-1 when open or partly open. Only the app can tell open, book and tabletop apart: read reservedRegions(kind: .division, options: .includeInactive) and check isActive and the region's shape.
  • We found no other route: no pose command in simctl or devicectl, no AppleScript dictionary, no URL route and no Darwin notification. devicectl device orientation set printed a new orientation, but the partly open phone didn't rotate.

Split View

On the inner display, the user drags the app by its home indicator to one side, then to the other (Tech Talk 111461). Two apps share the display 50/50 (Tech Talk 111466), and each app puts its bars on its outer edge (HIG: Designing for iPhone Duo).

Screenshots and video of each display

simctl io reads the screen and changes nothing:

xcrun simctl io booted enumerate                                      # lists the display ports
xcrun simctl io booted screenshot --display=primary   outer.png       # outer display
xcrun simctl io booted screenshot --display=primary-1 inner.png       # inner display
xcrun simctl io booted recordVideo --display=primary-1 --force inner.mov   # stop with Ctrl-C (SIGINT)
  • With the phone open and held wide, outer.png came out 2034 × 1398 and black, and inner.png 2853 × 2007. The size follows the current orientation.
  • These match Apple's App Store sizes for iPhone Duo: 1398 × 2034 (outer) and 2007 × 2853 (inner), portrait or landscape (screenshot specifications).
  • Device Hub's own screenshot button saves at full device resolution to the Desktop (Apple: capturing screenshots).
  • In a script, start recordVideo in the background and stop it with kill -INT <pid>; it then writes the file.

Install, launch, read output, clean up

xcrun simctl install booted path/to/MyApp.app
xcrun simctl launch --terminate-running-process booted com.example.MyApp
xcrun simctl terminate booted com.example.MyApp
xcrun simctl uninstall booted com.example.MyApp
  • launch --stdout=<file> sends print output to a file, but the app buffers it. In our run the file stayed empty while the app ran. To see output live, run launch --console-pty as a background job and send its output to a file. It blocks until the app ends, and simctl terminate ends it. In our run, the setup check's two DUO-SETUP lines appeared within seconds.
  • Pass launch arguments after the bundle ID. Set environment variables for the app with a SIMCTL_CHILD_ prefix (xcrun simctl help launch).
  • Uninstall test apps when you finish, so the shared simulator stays clean.

Settings you can read (and change with care)

xcrun simctl ui booted appearance        # light or dark
xcrun simctl ui booted content_size      # e.g. large

Both also take a value to change it, for example appearance dark. Put the old value back when you finish.

Known limits

From the Xcode 27.1 release notes and Xcode 27 release notes:

  • The first simulator launch can take several minutes.
  • StandBy isn't available in the iPhone Duo runtime.
  • Most app extensions can't run or be debugged in the iPhone Duo runtime.
  • An app using CameraCaptureAccessory can use both displays without a capture session. A real device needs one.
  • Device Hub can't send a two-finger touch. Trackpad pinch and rotate reach standard UIKit components as pointer events, which is not the same as two fingers on glass. Test multi-touch gestures on a device.
  • The simulator reports 60 frames per second at most. Test 120 Hz behaviour on a device (reference/device-facts.md).

Other ways to test resizing

Apple also suggests the resizable iOS simulator in Device Hub and iPhone Mirroring on macOS 27, resized to extreme sizes. It calls the iPhone Duo simulator the best way to test the full native experience (Apple: Three steps). In Xcode Previews, the canvas overrides picker has a Display group for the device's other display (Xcode 27.1 release notes).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    This skill prepares a macOS environment for developing and testing applications for the foldable iPhone Duo. It handles Xcode 27.1 configuration, simulator setup, and the integration of Claude Code with Xcode via the Model Context Protocol (MCP). The skill follows security best practices by avoiding global system modifications (like sudo xcode-select) and requiring explicit user approval for downloads and configuration changes.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at cffd95d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated last month
Other metadata
metadata
{
  "verified": "Xcode 27.1 (27A9275), iOS 27.1 simulator, device: no",
  "sources": "https://github.com/Kimeur/duology/blob/main/reference/sources.md"
}

README badge

README badge for kimeur/duology/duo-setup