Get Moshi
hooks · mata

Mata

The device host that comes with moshi-hook on macOS, and the commands agents use to drive simulators and emulators.

updated 4 days ago3 min readpage 34 / 59

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-hook 0.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:

on the Mac
$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

CommandWhat it does
mata listSimulators and Android devices, booted first
mata uiThe screen as an accessibility tree, in JSON
mata find "Save"Elements matching a label, identifier or value
mata screenshot -o s.jpgSave 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.2Swipe
mata pinch --scale 2Zoom in; below 1 zooms out
mata type "hello"Type into the focused field; --replace clears it first
mata key cmd+aPress a key or chord
mata paste "text", mata clipboard getPaste, and read or set the clipboard (iOS)
mata keyboard softShow the on-screen keyboard; hardware reconnects yours
mata button homeHardware buttons; Android adds back and volume
mata rotate leftRotate the device
mata posture bookFold 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 serve run 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.1 to keep it local.

Troubleshooting

  • cannot reach http://127.0.0.1:3070. Set MATA_URL as above.
  • No devices, or a blank screen. See preview troubleshooting.