back
loading skill details...
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…
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 18|26|27. For smaller
screens, iphone-se is an iPhone SE (3rd generation) and iphone-17e an
iPhone 17e. iPhone runs all three versions; iPad runs 26 and 27; 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> \
--selector localhost:3000 \
--selector localhost:8081 \
--selector "*.staging.example" \
--detach
Use the app's normal URLs, such as http://localhost:3000. Declaring
localhost:3000 also captures loopback forms such as 127.0.0.1:3000 and
[::1]:3000, plus [::ffff:127.0.0.1]:3000. Domain selectors (exact
api.corp.example or label-bound wildcard "*.staging.example") are
intercepted on the simulator and dialed from your machine whether or not the
name resolves on public DNS, so your DNS and VPN apply. Apps that resolve DNS
themselves over HTTPS bypass domain interception.
A tunnel carries TCP only: up to ten exact selectors and 64 domain selectors,
ports 1-65535 except 53; CIDRs and UDP are not supported. Start the tunnel
before launching the app or opening the page: connections opened earlier keep
their original route, so relaunch the app if it connected first.
One instance accepts one active destination tunnel, and its selector set is
immutable. To add or remove a destination, stop the tunnel and start it again
with the complete selector list:
lim ios tunnel status --id <ios-instance-id> --json
lim ios tunnel stop --id <ios-instance-id>
If the simulator attempts a route while its local service is stopped, the
tunnel remains active and reports connection_refused; restart the service
without recreating the simulator or tunnel.
Inspect HTTP traffic, capture HAR, persist a network log
Inspection is on by default: every HTTP and HTTPS request through the tunnel
is decoded, printed as one summary line per request (in the tunnel log file
when detached), and shown live in the console's network panel.
lim ios tunnel --selector "*.api.example" --har ./traffic.har --detach # write HAR 1.2 with bodies
lim ios tunnel --selector "*.api.example" --persist --detach # network log survives the instance
--persist uploads a body-inclusive network log as a session artifact when
the tunnel stops or the instance terminates; it appears on the instance's
session page in the console with a HAR download (default lifetime 3 days,
--ttl <seconds> up to 30 days). HTTPS is decoded with a simulator-trusted
CA, so apps with certificate pinning fail through inspected selectors:
leave the pinned host out of the selectors or pass --no-inspect to keep TLS
end to end (no summaries, HAR, or persistence).
Reaching services in a private network through a private tunnel
An organization can run a private tunnel: a connector inside its network,
created by an admin with lim tunnel create or in the console (Network) and
run with lim tunnel run, that serves every instance naming it. When the user names one, pass it at
create time instead of starting a tunnel yourself:
lim ios create --tunnel <tunnel-name>
The app reaches the tunnel's selectors, such as localhost:3000 or
*.internal.example, at those addresses. They resolve on the connector's
machine, not on yours. The tunnel takes the instance's one destination
tunnel, so do not start or stop lim ios tunnel on it.
Every HTTP and HTTPS request the tunnel inspects carries
Limrun-Instance-Id: <ios-instance-id>, so the service behind a shared tunnel
can tell your instances apart. To tag requests with your own values, such as a
test run ID, add --tunnel-header (repeatable):
lim ios create --tunnel <tunnel-name> --tunnel-header 'X-Run-Id: <run-id>'
The headers are fixed at create time and replace any value the app sends for
the same name. They show in the network capture, so never put secrets in them.
Creation checks the tunnel and fails when it is not usable:
tunnel <name> does not exist: the name is wrong or the tunnel was not
created. Ask the user for the right name.
tunnel <name> is offline: no connector is running. Ask the user to
start it.
did not attach within 30s: the connector cannot attach the instance.
Ask the user to check the connector's output.
Retrying the create in a loop does not help in any of these cases.
The tunnel's token belongs on the connector's machine. Never ask the user to
paste it into the conversation.
Send all device traffic through a proxy
Tunnels carry only declared destinations; there is no catch-all selector. When
the user wants all traffic, Safari included, to leave through their proxy (for
example a recording proxy), point the simulator's system proxy at a proxy the
tunnel reaches. Tunnel inspection passes requests meant for the proxy through as
sent.
lim ios tunnel --selector localhost:3128 --detach --id <ios-instance-id>
lim ios proxy set localhost:3128 --id <ios-instance-id>
# later, before stopping the tunnel:
lim ios proxy clear --id <ios-instance-id>
With a private tunnel whose selector is the proxy, only lim ios proxy set is
needed. A proxy elsewhere in the user's network works the same way:
--selector proxy.example.internal and lim ios proxy set proxy.example.internal:3128. Requests to localhost stay direct. New
connections use the proxy at once; apps keep connections they opened before
until relaunched. lim ios proxy clear restores the previous settings.
Trust a CA certificate
Add a PEM CA certificate to the simulator's trusted roots, for example the CA
of the user's recording proxy, so the proxy can read HTTPS traffic:
lim ios ca add ./proxy-ca.pem --id <ios-instance-id>
Safari and apps trust it on their next connection, with no restart, for the
life of the instance. Only one CA certificate per file; leaf certificates are
rejected. Apps that pin certificates, and the simulator's Apple services,
still reject it. To look at the app's traffic without a proxy of the user's
own, use tunnel inspection (above) instead.
Block domains
Keep the simulator's browser and apps away from sites, for example so an agent
driving the app cannot wander off to social networks. A blocked name does not
resolve on the device. Each entry is an exact name or a *. wildcard that
covers subdomains but not the name itself, so a whole site takes both entries.
Quote wildcards. Blocking needs lim 0.53.0 or later. Block from creation, so
the first page is already blocked:
lim ios create --blocked-domain facebook.com --blocked-domain '*.facebook.com'
On a running instance, edit the blocklist one change at a time:
lim ios blocklist add instagram.com '*.instagram.com' --id <ios-instance-id>
lim ios blocklist remove instagram.com --id <ios-instance-id> # '*.instagram.com' stays
lim ios blocklist list --id <ios-instance-id>
lim ios blocklist clear --id <ios-instance-id> # unblock everything
URLs, IP addresses, ports, and international names are refused with the name
to send instead; paths cannot be blocked. Safari and apps that already hold a
connection keep it until relaunched. Apps that resolve names over HTTPS
themselves, or connect to IP addresses, are not blocked. A blocked name wins
over a tunnel selector for the same name. Apple Watch simulators cannot block
domains.
Launching the app
The build skills reinstall and relaunch the app after every successful build,
so you usually don't need to launch it yourself. When the app is closed (a
fresh attach to an old build, or after a terminate), launch it by bundle ID:
lim ios launch-app <bundle-id> # foregrounds it if already running
lim ios launch-app <bundle-id> --mode RelaunchIfRunning # restart for a clean state
lim ios launch-app <bundle-id> --env API_URL=https://api.example.com --env FEATURE_FLAG=1
lim ios terminate-app <bundle-id> # stop it, e.g. to reset app state
If you don't know the bundle ID, run lim ios list-apps.
The PID column identifies apps running at query time. lim ios list-apps --json
and TypeScript listApps() include pid only for running apps, including
background apps. A PID does not indicate that the app is responsive.
--env KEY=VALUE is repeatable and restarts the app so the variables take effect.
An explicit --mode ForegroundIfRunning with variables is rejected. Use KEY=
for an empty value; the last occurrence of a key wins. Managed Detox launches
can combine --runtime detox with --env.
launch-app streams the app's logs and returns when the app exits or the
command is interrupted. Pass --detach to launch and return immediately.
When the app ends, launch-app prints the exit reason (crash, exit, or
terminated). After a crash it adds the exception and signal, the crash
message (for example a Swift Fatal error line or an uncaught exception's
reason), and the crashed thread's frames with the app's own function names.
That report is the way to see why an app died; frames carry no file and line,
which need the build's dSYM (atos -l <load address> with the address from
the report's Binary Images lines).
A React Native or Expo red error screen is not an exit: the app process keeps
running, so nothing is reported. In the TypeScript SDK, launchApp's
onExit(logs, info) gets the same report, and
monitorApp(bundleId, { onExit }) reports every exit of an app you did not
launch, for example one opened with lim ios open-url or relaunched by a test
runner, until stop(). watchApp, which reports only the next exit, is
deprecated.
While the app runs, launch-app also prints each main-thread hang: a hang
starts once the main thread hasn't answered for 1 second, and each report
gives its age, the thread's state and CPU time, and the top of its stack.
running with CPU time close to the age means the app kept its main thread
busy; waiting with little CPU time means it waited, and the top frame shows
on what. The hang's end gives its length. Hangs explain an app that freezes
or automation calls that stall, since reading the screen waits for the main
thread. In the TypeScript SDK, launchApp's onHang gets the same reports,
and monitorApp(bundleId, { onHang }) reports every hang of the app, across
relaunches, until stop().
App logs
App logs cover an installed app however it was opened, including a tap or
lim ios open-url, so there is no need to relaunch it to read them. Log
commands print recent lines and exit. Pass --follow only to keep streaming
until interrupted.
lim ios launch-app <bundle-id> --detach # launch and return, no log stream
lim ios app-log <bundle-id> # last 100 lines, then exit
lim ios app-log <bundle-id> --tail 100 # last N lines
lim ios app-log <bundle-id> --follow # stream until interrupted
lim ios syslog # up to 100 captured syslog lines, then exit
lim ios syslog --follow # stream simulator syslog
If an app dies at launch and its logs show nothing, launch it with
lim ios launch-app <bundle-id>. When the app ends before its code runs, for
example because dyld cannot load one of its frameworks, that launch prints
dyld's reason. An app opened by a tap or lim ios open-url cannot report it.
Syslog snapshots read the buffer filled by the current or an earlier syslog
stream. An empty buffer returns no lines. Snapshot reads need a runtime with
syslogTail support.
App performance
lim ios perf reads the CPU and memory of the apps you installed, the figures
Xcode's debug gauges show, and exits. The instance samples every running app
once a second and keeps the last ten minutes, so the command answers at once
and lists an app that stopped in that time as stopped. System apps are not
measured. CPU counts one busy core as 100%, and memory is the app's physical
footprint.
lim ios perf # each app now: CPU, memory, peak, threads, busiest threads
lim ios perf --app <bundle-id> --since 2m # average and highest CPU, highest memory over 2 minutes
lim ios perf --since 5m --json # the summary plus every sample, for scripts
lim ios perf --follow # stream one line per app per second
Check performance after a change that might slow the app down or hold on to
memory: run the flow, then compare a --since summary with one from before the
change. The figures come from the Mac that runs the simulator, which has no iOS
memory limit, so compare the app with its own earlier numbers rather than with
a device's budget.
To keep the samples of a whole test run, create the instance with
lim ios create --perf and list the saved files with lim ios perf-captures.
Debugging with LLDB
lim ios lldb attaches LLDB to a running app. LLDB runs next to the simulator,
so it works from Linux, and the arguments after -- go to lldb unchanged.
The app must be a debug build, because LLDB needs the get-task-allow
entitlement that Xcode adds to those, and it must already be running.
# One-shot: run the commands, print the output, exit
lim ios lldb --bundle-id <bundle-id> -- --batch -o "bt all" -o "frame variable"
# Symbols in a separate .dSYM: upload and load them first
lim ios lldb --bundle-id <bundle-id> --dsym ./MyApp.app.dSYM -- --batch \
-o "breakpoint set -f ContentView.swift -l 42" -o "continue" -o "frame variable"
# A script on standard input, for when a failing command must not end the run
printf 'bt\nframe variable\n' | lim ios lldb --bundle-id <bundle-id>
An app that lim xcode build installed on an attached simulator needs no
--dsym: the Xcode instance sends the build's debug symbols to the simulator
when the session starts, so file and line breakpoints and frame variable
work right after the build. This covers the latest successful build of the
workspace's Xcode instance. If a later build failed, build again first. Use
--dsym for an app built anywhere else, and for Bazel builds.
Always pass --batch unless you feed standard input: without it the session
waits for input until the input ends. In batch mode LLDB stops at the first
failing command, and continue waits until the app stops again, so trigger
the code path from another command (lim ios tap, lim ios open-url) while
the session waits. The app keeps running after LLDB detaches.
A simulator runs one LLDB session at a time. Backtraces, breakpoints,
stepping, frame variable, Objective-C expressions and Python scripting work.
Swift expression evaluation (expr, and po on Swift values) is not
available yet; read Swift values with frame variable.
Testing changes
When simulator interaction is part of the task, test new or changed
functionality with the interaction commands after each build. Focus on what
changed, plus a quick smoke test of core flows. Start by reading the element
tree to see what's on screen before acting:
lim ios element-tree
Interacting with the app
Prefer tapping by accessibility id, then by label, then coordinates as a last
resort:
lim ios tap-element --ax-unique-id startButton
lim ios tap-element --ax-label "Save"
lim ios tap 201 450
tap-element taps with a real synthesized touch. Elements the accessibility
tree can see are scrolled into view automatically. A selector that matches
nothing in the tree fails in about a second; iOS creates list rows lazily, so
a below-the-fold row often isn't in the tree at all. For those, pass
--scroll-search: the CLI pages the screen (a few pages down, then up)
retrying the tap until the row materializes, which can take ~10s. Pass
--activate ax to use an accessibility press instead of a touch (no
scrolling, works on elements without a usable frame).
Toolbar / nav-bar items usually can't be tapped by id. SwiftUI collapses
toolbar children into a single nav-bar group, and those items report
AXUniqueId: null even when you set .accessibilityIdentifier(...) (regular
content Buttons do expose it). So tap-element --ax-unique-id finds nothing
for a nav-bar button. Set an .accessibilityLabel / .accessibilityIdentifier
anyway for documentation, but to actually tap it, read its AXFrame from the
element tree and tap the center by coordinate:
lim ios element-tree --id <id> | grep -i -A6 -B2 moon # find the item's AXFrame
lim ios tap <x> <y> --id <id> # tap the frame's center
For text input, focus a field first (tap it), then type:
lim ios type "hello world" # real key events; errors if no field is focused
lim ios type "hi" --no-require-focus # skip the focus check: for fields focused by coordinate taps when the accessibility focus scan is unreliable
lim ios press-key backspace
lim ios press-key @ # shifted symbols work directly
type presses real keys, so text delegates fire and the field's own keyboard
behavior applies (a default text field autocapitalizes the first letter, for
example). To set a value verbatim with no keyboard behavior, use set-text:
lim ios set-text "P@ssw0rd!" --focused # into the focused field
lim ios set-text "hello" --ax-unique-id emailField # by selector
For scrolling and drags:
lim ios scroll down --amount 300 # from the screen center
lim ios scroll down --amount 300 --coordinate 200,400 # from a specific point
lim ios swipe --from 200,600 --to 200,200 # explicit drag; --duration 800 for a slower, precise one
After every interaction, re-run element-tree to confirm the UI transitioned.
No sleep is needed between a tap and element-tree; the tap blocks until done.
lim ios element-tree
Chain multiple actions with precise timing via perform:
lim ios perform --action type=tap,x=100,y=200 --action "type=typeText,text=Hello World"
lim ios perform --action type=wait,durationMs=1000 --action type=pressKey,key=enter
lim ios perform --file ./actions.yaml
Run lim ios perform --help for the full action grammar.
Screenshots and video
Screenshot takes a positional path (not -o):
lim ios screenshot screenshot.png
lim ios screenshot screenshot.png --id <ios-instance-id>
lim ios screenshot app-store.png --format png --size full --id <ios-instance-id>
Use --format png --size full for a full-resolution PNG without alpha, including screenshots intended for store uploads. Combine it with --display inner or --display outer on Duo. The SDK equivalent is client.screenshot({ format: 'png', size: 'full' }); it returns base64 PNG data and pixel dimensions. --format accepts jpeg or png and defaults to jpeg. --size accepts scaled or full and defaults to scaled. Choose them independently. scaled uses point dimensions; full preserves native pixel resolution. Tap coordinates remain in points, so use tapWithScreenSize for coordinates measured in a native screenshot.
Use the element tree for functional assertions (element existence, labels, state
changes) and screenshots only for visual properties. For anything involving
motion (animations, gameplay, streaming UI), prefer video:
lim ios record start # non-blocking
lim ios record stop -o /tmp/recording.mp4
For UI changes, include a demo video in the pull request so the user can see it.
App container files
List an app's data container before pulling a file so you use the exact path the
app created. Keep the same --bundle-id and --container-type flags for list,
pull, push, and delete:
lim ios ls Documents --bundle-id com.example.app --container-type data
lim ios pull-file Documents/recording.mov ./recording.mov \
--bundle-id com.example.app --container-type data
lim ios push-file ./fixture.json Documents/fixture.json \
--bundle-id com.example.app --container-type data
lim ios delete-file Documents/fixture.json \
--bundle-id com.example.app --container-type data
lim ios ls defaults to the staging-folder root. With --bundle-id, it
defaults to the app bundle (--container-type app); use data for the app's
writable Documents, Library, and tmp directories. Paths in ls output are
relative to the selected root and can be copied directly into the other file
commands.
Simulate the camera with a video
For camera-driven flows (QR-code scanning, document capture, video calls),
play a local video file as the simulator's camera. The app sees the frames
through its normal capture pipeline:
lim ios camera play ./fixtures/qr-scan.mp4 # loops by default
lim ios camera play ./fixtures/intro.mp4 --no-loop # play once, freeze on last frame
lim ios camera clear # restore the default camera
Any AVFoundation-decodable file works (H.264/HEVC in .mp4/.mov). Use
--no-loop when the app must observe the end of the clip exactly once (the
feed freezes on the last frame rather than stalling).
Clipboard
Set or read the simulator clipboard. Apps paste it like text copied inside the
simulator, so the edit menu's Paste shows no permission prompt. For example, to
paste a one-time code into a login form:
lim ios clipboard set "123456" # or pipe it: echo 123456 | lim ios clipboard set
lim ios clipboard get
lim ios simctl -- pbcopy booted and pbpaste booted do the same.
User defaults
Read, write, or delete the simulator's user defaults with its defaults tool.
Pass the arguments after --. Apps read defaults at launch, so relaunch the app
under test after a change. For example, to switch the device language and
region without UI automation:
lim ios defaults -- write -g AppleLanguages -array fr-FR
lim ios defaults -- write -g AppleLocale -string fr_FR
lim ios defaults -- read -g AppleLanguages
lim ios simctl -- spawn booted defaults ... does the same. Only read,
write, and delete are available.
System prompts, such as permission and location alerts, keep the old language
until their services restart. Restarting SpringBoard closes every running app:
lim ios restart-services com.apple.SpringBoard com.apple.locationd com.apple.tccd com.apple.akd
Darwin notifications
Post a notification, or set and read a notification's state, inside the
simulator with its notifyutil tool:
lim ios notify post <name>
lim ios notify set <name> <state>
lim ios notify get <name>
For example, the simulator drives Face ID through these notifications. Enroll
once, then answer each Face ID prompt with a match or a non-match (Touch ID
devices use fingerTouch in place of pearl):
lim ios notify set com.apple.BiometricKit.enrollmentChanged 1
lim ios notify post com.apple.BiometricKit.enrollmentChanged
lim ios notify post com.apple.BiometricKit_Sim.pearl.match # the next scan succeeds
lim ios notify post com.apple.BiometricKit_Sim.pearl.nomatch # the next scan fails
lim ios simctl -- spawn booted notifyutil -p|-s|-g ... does the same.
Privacy permissions
Grant or deny a permission before the app asks, so the system prompt never
appears, or read what the app was given:
lim ios permission set com.example.app camera granted
lim ios permission set com.example.app photos limited # selected photos only
lim ios permission set com.example.app notifications critical # critical alerts too
lim ios permission set com.example.app contacts denied
lim ios permission set com.example.app faceid unset # the app asks again
lim ios permission get com.example.app camera # granted, denied, limited or unset
Services: calendar, camera, contacts, faceid, health, homekit,
medialibrary, microphone, motion, notifications, photos, reminders,
siri, speech, and usertracking. Setting notifications restarts
SpringBoard, which closes every running app, so set it before launching the
app. Notifications cannot be read back. For location, use
lim ios simctl -- privacy booted grant location <bundle-id>.
Keychain
Wipe every keychain item, for example to sign the app out of an account it
remembers across reinstalls. CA certificates added with lim ios ca add stay
trusted:
lim ios keychain reset
To keep a logged-in state for later instances instead, save the keychain with
lim ios keychain save and apply it with lim ios keychain restore.
Orientation and hardware keys
lim ios set-orientation landscape-right # or portrait, portrait-upside-down, landscape-left
lim ios info reports the current orientation. Press any HID usage, such as a
media or brightness key, with perform. Page 12 usage 111 is Brightness
Increment:
lim ios perform --action type=usageDown,usagePage=12,usage=111 --action type=usageUp,usagePage=12,usage=111
Preview URL for humans
Upload the .ipa file directly or targz archive of the .app folder
to Limrun Asset Storage and return a preview URL for the user to open it and
test the app manually in the browser.
Here is how to upload it:
export ASSET_NAME=myapp.tar.gz # can be any name
lim asset push ${ASSET_NAME}
echo "https://console.limrun.com/preview?asset=${ASSET_NAME}&platform=ios"
Once the command finishes, you can give the following URL to the user to
click to open a simulator stream while the console installs this bundle.
https://console.limrun.com/preview?asset=${ASSET_NAME}&platform=ios
For nonsecret iOS app configuration, append repeatable URL-encoded env=KEY=VALUE
parameters, for example &env=FEATURE_FLAG%3D1&env=API_URL%3Dhttps%3A%2F%2Fapi.example.com.
Use URLSearchParams.append("env", "KEY=VALUE") when constructing links. The app
receives these variables on its first launch. Values are visible in the link
and browser history.
Add openUrl to open a URL or app deep link after launch, for example
&openUrl=myapp%3A%2F%2Fcheckout. Use URLSearchParams.set("openUrl", url) to
encode the full URL and its query string. This works with or without env;
the stream stays visible while the app installs, launches, and opens the URL.
An Installing <asset name> overlay shows installation progress and disappears
when the preview is ready.
Cleanup
When the work is completed, you can delete the iOS simulator.
lim ios delete
Gotchas
Instance resolution can miss in a non-git dir. See "Targeting the right
instance" above; pass --id when in doubt.
element-tree can be large. Pipe through grep / jq to extract what you
need rather than dumping the whole tree into context.
type / perform typeText may not drive SwiftUI (or React Native) state.
Automated text injection sets the field's value through accessibility, which
does not always fire a SwiftUI @Binding / onChange the way a real
keystroke does. Symptom: the text appears in the field (and in element-tree),
but reactive UI tied to it doesn't update (a send button stays disabled, a
character counter doesn't move) and submit handlers see empty state. A real
keyboard on the live stream works. When automating, drive submit through a
tappable control (a button, a suggestion chip) rather than relying on text
bound to reactive state, or have the app expose a test affordance.
Toolbar / nav-bar items aren't tappable by id. See "Interacting with the
app" above: read the AXFrame from element-tree and tap by coordinate.
Bundle ID discovery. If you don't know the bundle ID, run
lim ios list-apps after a successful install.
Build errors are the build skill's job. If the app isn't installing, the
failure is upstream; go back to limrun-bazel / limrun-xcode.
39:[don't have the plugin yet? install it then click "run inline in claude" again.