Mata
The device host that comes with moshi-hook on macOS, and the commands agents use to drive simulators and emulators.
Mata turns the iOS Simulators and Android devices on your Mac into something Moshi can show and an agent can control. This page covers running it and driving it from the command line. To watch and touch a device in Moshi, see Browser & simulator preview.
Requirements
- macOS 14 or newer and Xcode 26 or newer. Android also needs
adb. moshi-hook0.4.23 or newer. Mata is bundled; there is nothing else to install.
Mata uses private Xcode frameworks, so an Xcode update can break it. Run mata doctor to check.
Turn it on or off
Mata starts with the daemon and is on by default on macOS:
moshi-hook set mata off
moshi-hook set mata on
Restart the daemon after changing it. You can also flip mata in the app's hooks sheet, under Options.
If you already run mata serve on its default port, 3070, moshi-hook uses that one instead of starting its own.
Point the CLI at it
The Mata that moshi-hook starts listens on a private port and is served through the gateway. The CLI looks at port 3070 by default, so set MATA_URL first:
$export MATA_URL=http://127.0.0.1:24543/mata$mata list$mata ui
Or run mata serve yourself and skip MATA_URL. That also makes it reachable from your LAN and Tailscale; see Access.
If several devices are running, pick one with --sim <udid> or an adb serial such as --sim emulator-5554. The default is the most recently booted one.
Give your agent the skill
mata --skill prints a skill that teaches an agent to look at the screen, act, and check the result. For Claude Code:
mkdir -p ~/.claude/skills/mata
mata --skill > ~/.claude/skills/mata/SKILL.md
Commands
| Command | What it does |
|---|---|
mata list | Simulators and Android devices, booted first |
mata ui | The screen as an accessibility tree, in JSON |
mata find "Save" | Elements matching a label, identifier or value |
mata screenshot -o s.jpg | Save a JPEG |
mata tap 0.5 0.3 / mata tap --label "Save" | Tap a point, or an element (scrolls to it) |
mata swipe 0.5 0.8 0.5 0.2 | Swipe |
mata pinch --scale 2 | Zoom in; below 1 zooms out |
mata type "hello" | Type into the focused field; --replace clears it first |
mata key cmd+a | Press a key or chord |
mata paste "text", mata clipboard get | Paste, and read or set the clipboard (iOS) |
mata keyboard soft | Show the on-screen keyboard; hardware reconnects yours |
mata button home | Hardware buttons; Android adds back and volume |
mata rotate left | Rotate the device |
mata posture book | Fold an iPhone Duo (Xcode 27) |
Coordinates are fractions of the screen from 0 to 1. mata help <command> lists the options.
On Android, mata ui takes two to three seconds.
Mac windows
With moshi-hook 0.4.56 or newer, Mata can also show and control this Mac's app windows, even while the Mac is locked. It is off by default:
moshi-hook set mata-mac-windows on
It needs the Screen Recording and Accessibility permissions for moshi-hook, and applies without a restart. Anyone who can use your host gateway can then control those windows.
Access
- The Mata moshi-hook starts binds to
127.0.0.1. Moshi reaches it through the gateway over SSH. mata serverun by hand listens on every interface, but answers only loopback, your LAN and Tailscale. There is no password: anyone who can reach it there can control the device. Use--bind 127.0.0.1to keep it local.
Troubleshooting
cannot reach http://127.0.0.1:3070. SetMATA_URLas above.- No devices, or a blank screen. See preview troubleshooting.
Related docs
- Browser & simulator preview — watch and touch the device in Moshi.
- Hook settings — every
moshi-hook setoption.