looktap v0.7.7

Start

How it works

looktap ships its own small helper for each platform. Nothing is installed on simulators, emulators or Android devices. A real iPhone or iPad is the exception: it gets a small test runner (Using a real iPhone). The one Android exception is opt-in: looktap wifi --always installs a small app that keeps Wireless debugging on (built and signed on GitHub Actions, downloaded from the release; wifi --off removes it).

ItemiOS simulatorAndroid emulator / device
Read the screenlooktap-sim, a macOS helper that reads the simulator's accessibility tree through Apple's simulator frameworks (CoreSimulator, AccessibilityPlatformTranslation). Web content is found by probing the screenlooktap-server.jar, a 10 KB helper pushed to /data/local/tmp and run with app_process. It keeps one UiAutomation connection open
Tap, type, swipe, keysThe same helper, as touch and keyboard events through SimulatorKitThe same helper, as input events through UiAutomation
Clipboard (paste)simctl pbcopy, checked with simctl pbpaste; when Xcode 27's clipboard sync (dtpasteboardd) wins over it, the Mac's clipboard, which the sync carries in, then put backThe helper sets the clipboard as the shell (IClipboard), then the field's paste action or the paste key
Screenshots, burstThe simulator display's framebuffer, read in-processEmulators: the emulator's gRPC API, which also gets past FLAG_SECURE. Devices: the helper
Video (record)simctl io recordVideoscreenrecord on the device
Folding (fold)What Device Hub's fold buttons send: a vendor-defined HID report with the hinge angle, through dtuhidd. devicectl says which screen is lit, and the helper reads, touches and captures that one—
Orientation (rotate)The orientation event Simulator.app sends to the guest (the iPhone Duo: Device Hub's orientation report). Coordinates and frames are converted, so everything looktap prints and takes is as the user sees the screensettings (user rotation, auto-rotate off). The helper reports the turned display size
Logs, crasheslog show inside the simulator, and its .ips crash reportslogcat (by app uid), the crash buffer, and dumpsys activity exit-info
Home button, stopThe helper sends the hardware Home button; simctl terminateKEYCODE_HOME; am force-stop
Deep links, launch, biometricsxcrun simctladb and the emulator console

Each helper starts on first use, keeps running in the background, and is replaced automatically when looktap is upgraded. looktap setup starts it ahead of time, and looktap teardown stops it. The CLI talks to it over a local socket, using JSON lines.

iOS: private frameworks and Xcode versions

The iOS helper uses Apple's private simulator frameworks, the same ones idb uses. They can change between Xcode releases. looktap doctor checks they're present and shows which input path applies:

  • Xcode 26 and earlier (CoreSimulator below 1155.4): touches, keys and the Home button go through SimulatorKit's HID client ("indigo"). Tested.
  • Xcode 27 (CoreSimulator 1155.4 and later): touches, keys and the Home button go as XPC messages to the simulator's dtuhidd service ("dtuhid"), the same way idb does it. Tested on Xcode 27.1 with iOS 26 and iOS 27 simulators. Reading the screen and screenshots don't depend on it. Xcode 27.1 moved SimulatorKit to Contents/SharedFrameworks, which looktap 0.7.1 and later finds; it also replaced the Simulator app with Device Hub (see boot).

LOOKTAP_IOS_HID=indigo|dtuhid overrides the choice. It applies when the helper starts, so run looktap teardown first.

Using a real iPhone

A simulator can be driven from the Mac with nothing installed in it; a real iPhone or iPad can't. So the first command aimed at one builds a small XCUITest runner (native/ios-device), signs it with your Apple ID, and installs it. It reads the screen and taps, types and swipes through XCUITest, and looktap reaches it over USB or Wi-Fi (see how it connects below). Every looktap user signs the runner with their own Apple ID. A free one is enough; the paid Developer Program isn't needed.

Once per Mac and device:

  1. In Xcode → Settings → Accounts, sign in with your Apple ID. That gives you a "Personal Team".
  2. Pair the device with the Mac (connect it with a cable once and tap Trust; Wi-Fi works after that), and turn on Developer Mode on it: Settings → Privacy & Security → Developer Mode. (An iPhone on iOS 16 or older without a passcode needs no hand here: looktap setup -d <UDID> turns it on, see Older iPhones.)
  3. Unlock the device and run any command against it, for example looktap -d <hardware UDID> ls (looktap devices lists the UDID, and says what to do if the device isn't ready yet: Trust, Developer Mode). The first run builds the runner, which takes about a minute.
  4. With a free Apple ID, the device asks you to trust the developer the first time: Settings → General → VPN & Device Management → your Apple ID → Trust. Then run the command again.

If Xcode is signed in to more than one team, choose the one to sign with: LOOKTAP_TEAM=<team id>, or {"ios": {"team": "<team id>"}} in looktap.config.json. The error message lists your teams and their ids.

Picking the device: -d <hardware UDID> always picks it. Without -d, a paired device is used only when no simulator or emulator is running, so nothing changes for simulator workflows.

Signing expiry: a runner signed with a free Apple ID stops launching after 7 days, and one signed with a paid team after a year. looktap reads the expiry date and builds and signs the runner again before it lapses. If iOS refuses to launch it anyway (for example, after a certificate was revoked), looktap rebuilds it once and retries. Free Apple IDs have Apple's own limits too: about 3 devices and 10 app ids per 7 days, and at most 3 apps signed by the free account installed on one device at a time. The runner counts as one, so if the device is full, looktap names the apps it found and you delete one.

What works on a device: everything except location, network, push, statusbar, textsize, bio, record, permission, reset and crashes, which say so (on iOS 16 and older, location and crashes work); zoom works around the screen's centre only. logs reads the phone's live log (lockdown's syslog relay, as Console.app does), collected in the background from the first logs or launch on, since the phone keeps no history looktap can read. perf reads CPU, memory and threads through Instruments (xcrun xctrace, part of Xcode), 10–25 s a reading, and perf --frames reads the screen over the USB cable, so it needs the phone plugged in rather than on Wi-Fi. Platform support has the reasons, and looktap capabilities prints them. A command takes about 1–1.5 s, slower than on a simulator, because XCUITest takes longer to read the screen.

The device must be unlocked while the runner starts. It keeps running until looktap teardown, or until the device is restarted. While the device is locked, commands that need the screen stop with "the device is locked" (stop still works), and looktap devices shows locked up front. --wait-unlock 60 (or "waitUnlock": 60 in the config, LOOKTAP_WAIT_UNLOCK=60) waits up to that many seconds for someone to unlock it instead, then runs the command; useful in a long flow, where the phone locks itself after a while. A runner can lose its permission to drive the screen while it keeps running (seen after the device sat idle); looktap then starts a fresh one, once, and carries on.

How looktap reaches the phone

Each command tries, in order: USB (usbmuxd, when the cable is in), the CoreDevice tunnel (how Xcode itself reaches a phone on Wi-Fi, and what starts the runner), then usbmuxd's own Wi-Fi route. A network can block the last while the tunnel works. Plugging in a cable mid-session moves to USB at the next command, with no teardown.

When the runner is up on the phone but no route reaches it, looktap says so within about 20 s, with what each route answered, instead of waiting minutes: usually the network isolates its clients, or a VPN or firewall sits between the Mac and the phone. Plug in a cable and run the command again; the runner keeps running, so nothing restarts. looktap doctor -d <UDID> checks each step on the way: pairing, Developer Mode, the tunnel, usbmuxd, the lock screen, which routes the runner answers on, and the signing team.

Older iPhones (iOS 16 and earlier)

Xcode 27 no longer supports iOS 16 devices: it lists one without a UDID and won't build for it, install on it or start a test on it, and that's the way looktap reaches newer phones. So for an iPhone older than iOS 17, looktap does Xcode's part itself, through the services the phone's lockdown daemon offers over usbmuxd (USB, or Wi-Fi once paired):

After that it's like any other iPhone: looktap devices lists it as iOS 16.7 (through lockdown), and install, apps, uninstall, launch, stop and the screen commands work. location <lat> <lon> works too (the developer image's simulated location, as in Xcode), and crashes reads the phone's crash reports. perf doesn't (Instruments needs Xcode's support), but perf --frames does. looktap doctor -d <UDID> checks Developer Mode and the image.

Android: the fallback path

If the helper can't start (for example, another tool holds UiAutomation), looktap falls back to plain adb + uiautomator dump. That works everywhere but takes about 2.5 s per screen read. LOOKTAP_ANDROID_HELPER=0 forces that path.

Generated from README.md. Edit it there.