SkilVaultSign inStart free

Catalogue / limrun-ios-simulator

limrun-ios-simulator

MITSignedDrive an app running on a Limrun cloud iOS simulator: launch, tap, type, read the accessibility element tree, read app logs and simulator syslog, check the app's CPU and memory, screenshot, record video, connect the app to local services or a private tunnel, access a server inside the simulator thro…
---
name: limrun-ios-simulator
description: "Drive an app running on a Limrun cloud iOS simulator: launch, tap, type, read the accessibility element tree, read app logs and simulator syslog, check the app's CPU and memory, screenshot, record video, connect the app to local services or a private tunnel, access a server inside the simulator through localhost, play a video file as the camera, send all traffic through the user's proxy and trust its CA, block domains, set the clipboard, read and write user defaults, post notifications, grant privacy permissions without prompts, wipe the keychain, rotate the device, and run timed action chains. Use after a build (from any builder) when the user wants to see, test, or interact with their app on a simulator, or says 'show me a screenshot', 'tap', 'run the UI test', 'record a video', 'read the logs', 'how much memory does it use', 'is it using too much CPU', 'connect localhost', 'reach my local server from the simulator', 'route all traffic through my proxy', 'trust my CA', 'block this site', 'mock the camera', 'paste into the app', 'change the language', 'simulate Face ID', 'grant camera access', 'skip the permission prompt', 'log out by clearing the keychain', 'rotate to landscape', or 'launch on simulator'. To build the app first, use limrun-xcode-bazel (Bazel workspaces) or limrun-xcode (xcodebuild projects)."
user-invocable: true
effort: high
---

Limrun iOS Simulator

Interact with an app running on a Limrun cloud iOS simulator, from any environment (Linux, Windows, macOS, VM, container). This skill is build-agnostic: it assumes the app was already built and installed by a build skill (limrun-bazel for Bazel, limrun-xcode for xcodebuild). Keep build concerns in those skills; this one is about driving the running simulator.

Never use local Xcode, local simulators, or local macOS tools.

To disconnect the simulator from its build sandbox and stop automatic installation, run lim xcode detach-simulator --id <xcode-instance-id>. Both instances, installed apps, and retained builds remain available. Repeated detach requests succeed.

Auth and CLI

Install if needed: npm install --global lim. Auth is lim login or LIM_API_KEY (it may already be set in the user's environment even when .env and the shell do not show it; check before asking for it). The CLI is the source of truth: the commands in this skill are verified, but if a flag errors or you need one not shown here, check lim ios <subcommand> --help instead of guessing.

Choose the device model and iOS version

lim ios create takes --model iphone|iphone-se|iphone-17e|iphone-duo|ipad|watch (default iphone, an iPhone 16 Pro) and --os-version 26|27. For smaller screens, iphone-se is an iPhone SE (3rd generation) and iphone-17e an iPhone 17e. iPhone and iPad run both versions; iPhone SE, iPhone 17e and iPhone Duo run 27; Apple Watch runs 26. The default is 26, or 27 on the models that run only 27.

lim ios create --model ipad --os-version 27

Installing an app bundle

You can either use Limrun remote Bazel or Xcode services to build the app bundle and have it installed to the simulator automatically or you can sync a pre-built local .ipa file or .app folder to the simulator. The main requirement is that it must be built for simulator.

Build and install

Prefer attaching the simulator to its build sandbox for repeated builds. After the first transfer, rebuilds skip unchanged files and send binary patches when smaller. Small rebuilds can be much faster than uploading the full app to Asset Storage and downloading it to the simulator each time.

A build skill usually attaches the simulator for you (lim xcode rbe --ios, or lim xcode build . then attach). Check what's already there:

lim xcode get      # is a simulator attached to the current build target?
lim ios list       # all running iOS instances

If none is attached, create one. It installs the last build immediately, so you don't need to rebuild:

lim ios create --attach

If the create (or lim xcode rbe --ios) output includes a signed stream URL, share it with the user as a Markdown link, like [Live simulator](<signed-stream-url>). If you have a browser the user can see, open the URL there and tell them. Otherwise pass --no-open to create: it skips opening the URL locally and still prints it for sharing.

lim xcode get prints a Limrun console URL instead. It opens the same live view but requires a console login, so prefer the signed stream URL for sharing. If the console URL is all you have, share it and mention it needs login.

Signed links open the shared device workspace without login. Full instance tokens show Inspect, Connect, and the logs, events, and network inspector. Stream-only tokens show the screen and input controls without those tools. Stop and app selection require the authenticated console.

Install app from local

Create a new simulator:

lim ios create

Share the signed stream URL with the user as a Markdown link, like [Live simulator](<signed-stream-url>). If you have a browser the user can see, open the URL there and tell them.

You can then run the following command to upload a bundle from local:

lim ios sync <path to .ipa file or .app folder>

You can run the same command every time you need to install a new version of the bundle. It will patch with the difference and reload it in the simulator.

Fold an iPhone Duo

Create a Duo instance in a region that offers it:

lim ios create --model iphone-duo
lim ios fold --json --id <instance-ID>
lim ios fold 90 --orientation landscape-left --id <instance-ID>
lim ios fold 90 --id <instance-ID>
lim ios fold 180 --id <instance-ID>
lim ios screenshot ./inner.png --display inner --id <instance-ID>
lim ios tap 300 200 --display inner --id <instance-ID>

The hinge accepts fractional angles from 0° (closed) to 180° (flat). Omit the angle to read fold state. --orientation accepts portrait, pud (portrait upside down), landscape-left, or landscape-right; it can change independently of the hinge angle. This changes the native simulator hinge, so apps receive Apple's hinge and layout updates. The browser stream starts in 2D and offers a lazy-loaded 3D frame. Both modes provide hinge and rotation controls, with touch input on the cover and inner display. The frame's Sleep/Wake and volume buttons accept clicks and holds even when position is locked. For automation, pair buttonDown and buttonUp actions with button set to side, volumeUp, or volumeDown in client.performActions.

With an already connected TypeScript device client:

const fold = await client.getFoldState(); // null on an ordinary simulator
await client.setHingeAngle(110);
await client.setDuoOrientation('landscape-left');
const inner = await client.screenshotDisplay('inner');
await client.tapDisplay('inner', inner.width / 2, inner.height / 2);

setDuoOrientation accepts portrait, landscape-left, landscape-right, and pud (upside down). Use outer for the cover or inner for the unfolding display. Display screenshots are upright and use point dimensions by default; tapDisplay uses points. With { size: 'full' }, screenshot dimensions are native pixels instead. See "Screenshots and video" for format and resolution options. An explicit display target does not activate that display; a display that iOS has turned off returns a black image.

For gestures, use client.performActions(actions, { display: 'inner' }) with touchDown, touchMove, and touchUp in upright screenshot points. Insert a wait to hold a touch. For two fingers, supply x2 and y2 together on each down, move, and up action. client.scroll('down', 300, { display: 'inner' }) uses the same display. Omitting display follows the active panel for taps, scrolls, and raw gestures. The CLI follows the same default: lim ios tap, scroll, swipe, and perform accept --display inner|outer as an override. Each new action resolves the active panel. A held raw touch keeps its original panel until touch-up.

Default screenshots capture the active display. Default recordings follow the active display across folds, keeping the initial canvas size and letterboxing other aspect ratios. Use screenshotDisplay('inner') or CLI screenshot --display inner to select one panel. Use startRecording({ display: 'inner' }) or CLI record start --display inner to keep recording that panel. These overrides also accept outer.

tapElement, its scroll search, and batched element taps follow the active display. elementTree() reads the frontmost app, including on the active inner display, and preserves Apple's reported accessibility frames. On Duo, the application root can stay at 669 × 951 points while its window and descendants use the upright inner display's 951 × 669 point coordinates. Use the width and height from a default, point-sized screenshot() or screenshotDisplay() for the canvas. Do not clip, scale, or rotate descendants using the root's size. If a renderer needs a root that fills the canvas, resize a presentation copy and preserve the original tree. Apps in iPhone compatibility mode can report app-local frames inside a centered window, so check their window placement before mapping coordinates.

Read (await client.getFoldState())?.displays.filter(display => display.active) to identify active panels. The hinge angle alone does not identify the active panel. Automatic input, selector actions, and screenshots require exactly one active panel; retry after the fold settles if none or both report active. If the activity query fails, getFoldState() still returns geometry but omits active. Hinge, orientation, and unsolicited fold-state responses also omit it.

The 3D viewer supports single-finger touch and drag. Rotating the view changes the camera; Rotate device changes native orientation. Laptop view sets the hinge and orientation; it does not enable Apple's separate Table Mode.

Targeting the right instance

Most lim ios commands default to the last created instance and resolve the "current" one from the git repo / worktree of your cwd. So even when a simulator is attached and lim xcode get shows it, a lim ios command can still report No instance ID provided and no recent ios instance found, because your cwd isn't the git worktree where the instance was created (or isn't a git repo at all). This bites most often right after lim xcode rbe --ios in a fresh project.

The reliable recipe when that happens:

lim xcode get                          # shows the attached simulator's ID
lim ios element-tree --id <that-id>    # pass --id to EVERY lim ios command

lim xcode get is the dependable source for the attached simulator's ID (lim ios list also works). Once you have it, pass --id <ios-instance-id> to all lim ios calls for the rest of the session (screenshot, tap, type, element-tree, record). Alternatively, git init the project so the workspace resolves on its own. When controlling multiple instances, always pass --id.

Accessing HTTP servers inside the simulator

To connect a local tool to an HTTP server running inside the simulator, use lim ios forward <local-port>:<remote-port> and keep it running. The tool connects to http://127.0.0.1:<local-port>; the CLI handles Limrun authentication. See port forwarding for server requirements and examples.

Reaching services on the local machine

Destination tunnels let an iPhone simulator app keep calling its normal destinations while the CLI dials them from the machine running lim. Select exact localhost:port or literal IP:port destinations, or domains that only your machine or VPN can reach:

lim ios tunnel \
  --id <ios-instance-id> \

Preview shortened. The full SKILL.md is in the pack.