Deterministic scripts to drive + capture the booted iOS Simulator from the shell — built while fixing the tux soft-keyboard bug (#184). The point: reliably tap the sim and see what a tap triggers, including UI that flashes for a few frames.
- Boot a sim with an installed runtime:
xcrun simctl list runtimes # need e.g. iOS 26.5 xcrun simctl create washe-test "iPhone 17 Pro" com.apple.CoreSimulator.SimRuntime.iOS-26-5 xcrun simctl boot washe-test && open -a Simulator
- Install deps:
brew bundle --file=osascript/Brewfile(cliclick + ffmpeg) - Grant Accessibility to BOTH the controlling terminal AND the
cliclickbinary (System Settings → Privacy & Security → Accessibility →+→⌘⇧G→/opt/homebrew/Cellar/cliclick/<ver>/bin/→cliclick).- The terminal grant covers
osascript/System Events (window reads, menu clicks). It does not cover cliclick — CGEventPost button events fail silently without cliclick's own grant (cursor moves still work, so a moving cursor is NOT proof clicks land).
- The terminal grant covers
- Move the window to the main display:
./sim-move-to-main.shcliclick reads a leading-as a relative move, so a left-hand display (negative X) can't be tapped.
Everything takes device-pixel coords — the pixels of
xcrun simctl io booted screenshot. Check your device's size once with
sips -g pixelWidth -g pixelHeight shot.png and export IMAGE_W/IMAGE_H if it
isn't the iPhone-17-Pro default (1206×2622). Mapping to screen coords assumes the
device glass is rendered height-constrained inside the window content area
(below a ~28pt title bar) and horizontally centered.
| script | what |
|---|---|
sim-window-geometry.sh |
print live window frame X Y W H |
sim-move-to-main.sh [X Y] |
move sim window to main display (default 80,60) |
sim-tap.sh <dx> <dy> |
real HID tap at device px (cliclick) |
sim-swipe.sh <x1> <y1> <x2> <y2> |
real HID drag (washe page-turn etc.) |
sim-shot.sh [out.png] |
screenshot |
sim-capture-tap.sh <dx> <dy> [base] |
record → tap → montage (the main loop) |
sim-hardware-keyboard.sh |
toggle Connect Hardware Keyboard (suppresses the soft keyboard when on) |
ffmpeg-montage.sh <in.mov> … |
tile a recording into one grid image (catch ~150ms flashes) |
ffmpeg-frames.sh <in.mov> … |
extract individual stills from a recording |
- I/O → Keyboard → Connect Hardware Keyboard (✓ by default): your Mac keyboard types into the sim. This does NOT reliably suppress the on-screen keyboard on modern iOS — the soft keyboard can still show on focus.
- I/O → Keyboard → Toggle Software Keyboard (
⌘K): force-show/hide the on-screen keyboard. It's a persistent toggle — if you hide it to read the screen, laterfocus()calls won't show it until you toggle back. Reset the sim (Device → Erase All Content and Settings) if the state gets confusing. - First time the soft keyboard appears you get iOS's QuickPath "slide to type" intro with a Continue button — dismiss it once (a physical tap in the window is most reliable; synthetic taps on that modal can be flaky).
- To read the REPL prompt while typing, hide the soft keyboard with
⌘K(the textarea stays focused) and type viaosascript -e 'tell application "System Events" to keystroke "..."'— the full screen is then unobscured. sim-hardware-keyboard.shclicks the Connect Hardware Keyboard item; menu clicks can occasionally no-op, so verify the mark with the AX query in that script.
It does an AX-press on the element under the point (returns
group 1 of window …), which web content ignores. Only real HID events become
iOS touches — hence cliclick.