iOS Device Driver¶
jumpstarter-driver-iosdevice connects existing iOS tools to one leased iPhone
or iPad through usbmux. The exporter owns device pairing; clients use a
lease-scoped proxy identity. Device tools such as go-ios and libimobiledevice
are installed separately.
Installation¶
$ pip3 install --extra-index-url https://pkg.jumpstarter.dev/simple jumpstarter-driver-iosdevice
Choose the tools needed for your workflow. Install these tools separately under their respective licenses; Jumpstarter does not bundle or download them.
Tool |
Common use |
|---|---|
Device management and automation |
|
Device utilities and libraries |
|
Access a remote usbmux endpoint from local tools |
|
UI automation; the exporter can run it for the lease |
The exporter needs a running usbmux daemon and a device running iOS 17.4 or later. Pair the device on the exporter before leasing it. Developer services also require Developer Mode, a compatible mounted developer image, and any on-device approvals requested by your tools. Jumpstarter does not configure these prerequisites or provide physical power control.
Preparing a physical device¶
Do this once per device, on the exporter host, with the device unlocked:
Connect the device over USB. When iOS asks Trust This Computer?, tap Trust and enter the device passcode. This creates the pairing record the exporter owns; clients never receive it.
Enable Developer Mode: Settings > Privacy & Security > Developer Mode, turn it on and restart when asked. After the restart, swipe up to unlock and tap Enable in the prompt, then confirm with the passcode. If the toggle is not shown, connect the device to Xcode or a developer tool once so iOS offers it.
For UI automation with Appium, enable Settings > Developer > Enable UI Automation.
Verify from the exporter host with libimobiledevice:
idevice_id -llists the UDID andidevicepair validateconfirms the pairing.
Keep the device unlocked while tools install or launch test runners; iOS may ask for further approvals on screen.
Configuration¶
export:
ios:
type: jumpstarter_driver_iosdevice.driver.IosDevice
config:
usb_port: "1-4.2"
http_port: 8100
forward_ports: [9100]
On Linux, usb_port is the device’s USB topology name under
/sys/bus/usb/devices. It selects the bench port, so replacing the device does
not require changing the configuration. On macOS, or to select a particular
device, use udid instead. USB transport requires exactly one selector.
For an operator-provided remote usbmux daemon, set transport: network,
usbmux_host and udid. The endpoint must speak usbmux; it is not the device’s
own IP address. Protect the network connection to the remote daemon separately;
that connection uses plain TCP.
Config parameters¶
Parameter |
Description |
Type |
Required |
Default |
|---|---|---|---|---|
|
Local USB daemon or remote usbmux daemon: |
str |
no |
|
|
Linux USB topology name, for example |
str |
one USB selector |
— |
|
Device identifier |
str |
one USB selector; required for network |
— |
|
Local usbmux daemon socket |
str |
no |
|
|
Remote usbmux daemon host |
str |
for network |
— |
|
Remote usbmux daemon port |
int |
no |
|
|
|
str |
no |
|
|
Device ports available as raw TCP forwards |
list[int] |
no |
|
|
Device HTTP service to expose through verified HTTPS |
int |
no |
— |
|
Discovery and connection timeout, in seconds |
float |
no |
|
|
Target label: |
str |
no |
|
|
Let macOS clients show the device in Xcode’s Device Hub |
bool |
no |
|
|
File that keeps the Device Hub identity and paired Macs |
str |
no |
— |
|
UDID the device presents in Device Hub |
str |
no |
the device’s UDID |
|
Run Appium on the exporter for this device; see Appium |
dict |
no |
— |
http_port and devicehub require exporter trust mode. http_port must not
also appear in forward_ports. The operator starts the HTTP service. Lockdown port 62078
cannot be configured as http_port or forwarded raw in exporter mode.
Usage¶
The commands below assume an export named ios inside a jmp shell session.
j ios info
j ios serve
j ios -- idevice_id -l
j ios connect
j ios forward 9100
j ios https
j ios devicehub # macOS clients only
j ios devicehub --wda WebDriverAgentRunner.xctestrun
serve prints a loopback address and USBMUXD_SOCKET_ADDRESS for your tool.
Keep it running while the tool uses the device. The -- COMMAND... form sets
that variable for one command. connect registers the address with your
installed usbfluxd using usbfluxctl, then removes its registration on exit.
An existing registration is left in place.
forward accepts only configured device ports. Python’s
forward(port, local_port=0) selects a free local port; the default local port
matches the device port. Raw forwards retain the application’s protocol.
Device Hub (macOS clients only)¶
With devicehub: true on the exporter, a Mac holding the lease can view and
control the device in Xcode’s Device Hub while the device stays plugged into
the exporter. This needs a macOS client with Xcode 27 or later, and Python 3.13
or later on the exporter for the tunnel’s TLS-PSK. On other
platforms devicehub is left out of j ios --help, and running it, or calling
devicehub() from Python, fails with an error that says so. On a Mac without
Xcode 27, or before Xcode has been opened once to install its device support,
devicehub warns that the device will not appear in Device Hub.
The Mac reaches the device through a virtual network link, created once per
boot with administrator rights. When it is missing, j ios devicehub explains
what it changes and offers to create it; sudo then asks for your password.
The link lets your account capture packets on every interface until the next
reboot. Without a terminal to answer in, the command prints the setup command
instead; the script is installed with this package, in its
jumpstarter_driver_iosdevice/scripts directory.
Inside a lease:
j ios devicehub
The first time a Mac uses a device, choose File > Pair Nearby Device… in
Device Hub and type the code it shows when the command asks. Later leases show
the device without a code. If the device is not listed in Device Hub, for
example after Unpair, choose File > Pair Nearby Device… while the command runs:
it asks for the new code. --pair asks for a code straight away. When the
command stops, the device stays paired and moves to Device Hub’s Unavailable
section until the next lease.
Set devicehub_state to keep the device’s Device Hub identity across exporter
restarts; without it, every Mac pairs again after a restart. Set
devicehub_udid only when the same Mac can also see the device directly, as on
a test bench, so that Device Hub keeps the two apart.
Appium through Device Hub¶
Device Hub also gives Xcode on the Mac the device’s developer services, so WebDriverAgent (WDA) can run over the same connection: tests run on the device while you watch them, and can pause to inspect it, in Device Hub. Appium then runs on the Mac rather than the exporter; the UI automation guide compares the two.
Build WDA once, signed with a provisioning profile that includes the device; Jumpstarter does not build or sign it. From the WebDriverAgent checkout that your Appium XCUITest driver uses:
xcodebuild build-for-testing -project WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner -destination generic/platform=iOS \
-derivedDataPath wda DEVELOPMENT_TEAM=<team> \
PRODUCT_BUNDLE_IDENTIFIER=<your.prefix>.WebDriverAgentRunner
Turn on Settings > Developer > Enable UI Automation on the device. Then,
inside a lease, pass the .xctestrun file the build wrote under
wda/Build/Products:
j ios devicehub --wda wda/Build/Products/WebDriverAgentRunner_iphoneos27.1-arm64.xctestrun
The command shows the device in Device Hub, has Xcode install and start WDA
through the lease, starts your installed Appium on this Mac, and prints the
Appium URL, WDA’s address and the capabilities to use. --appium PATH selects
the Appium launcher, and -- COMMAND runs a command with the endpoint in its
environment instead. Appium and WDA stop when the command stops. From Python,
devicehub_appium() does the same for the length of a with block and yields
the same target as ios.appium.serve(), so tests do not change between the two:
from appium import webdriver
from appium.options.ios import XCUITestOptions
from jumpstarter.common.utils import env
with env() as root, root.ios.devicehub_appium("wda/Build/Products/WebDriverAgentRunner.xctestrun") as target:
options = XCUITestOptions().load_capabilities(target.capabilities())
options.set_capability("appium:bundleId", "com.apple.Preferences")
# or an application of your own: options.set_capability("appium:app", target.upload_app("build/MyApp.ipa"))
driver = webdriver.Remote(target.url, options=options, client_config=target.client_config())
try:
print(driver.page_source)
finally:
driver.quit()
Appium runs on the Mac here because only the Mac reaches WDA, at the device’s address inside the Device Hub connection rather than over Wi-Fi. Install Appium and its XCUITest driver on the Mac; Jumpstarter does not bundle them.
Sessions behave as on the exporter’s Appium. Appium installs apps, reads logs and resets devices through usbmux, which this connection does not provide, so the target’s URL is a gateway in front of it that applies the exporter’s rules and fills the gap:
appium:app,appium:otherAppsandmobile: installApptake tokens fromtarget.upload_app()(an.ipa, a zipped.appor an.appbundle built for devices). The gateway installs them withxcrun devicectl, removing an installed copy first unless you ask forappium:noReset, as Appium does, and startsappium:appby its bundle identifier. Tokens fromios.appium.upload_app()belong to the exporter’s Appium and do not work here.appium:bundleIdworks: Appium checks for installed apps through devicectl.mobile: removeAppuninstalls with devicectl, andmobile: killAppstops the app asmobile: terminateAppdoes.appium:fullReset,appium:usePreinstalledWDAandappium:mjpegServerPortare ignored, as on the simulator, where the target fixes them;appium:resetLocationServiceandappium:customSSLCertare rejected.Web views, MJPEG screen streaming,
mobile: listAppsand the device’s logs also need usbmux and are not available.
HTTPS services¶
https(port=0) returns an endpoint with url, ca_file and provider-defined
JSON metadata. It does not interpret metadata or configure a particular tool.
For example, an HTTP service with a /status route can be queried with:
import urllib.request
from jumpstarter.common.utils import env
with env() as root, root.ios.https() as endpoint:
with urllib.request.urlopen(endpoint.url + "/status", context=endpoint.ssl_context(), timeout=10) as response:
print(response.read().decode())
j ios https prints those three fields as JSON and waits until Ctrl+C.
j ios https -- COMMAND... supplies JUMPSTARTER_IOS_HTTPS_URL,
JUMPSTARTER_IOS_HTTPS_CA_FILE, and JSON JUMPSTARTER_IOS_HTTPS_METADATA to the command.
endpoint.environment() copies the caller’s environment and adds Node CA
trust through NODE_EXTRA_CA_CERTS. Existing explicit CA bundles are extended
without modifying their files. Unset Python trust variables remain unset;
Python callers use ssl_context() or their HTTP library’s CA-file option.
Certificate and hostname verification stay enabled, and
NODE_TLS_REJECT_UNAUTHORIZED=0 is rejected.
All listeners bind 127.0.0.1. Closing a context removes its listener and
public CA files; keep the context open for the tool’s entire lifetime. Exporter
services and identities are revoked at lease teardown, reset or device detach.
Externally started device services remain owned by their launcher.
Appium¶
With an appium block, the exporter runs Appium
for the lease, and clients open sessions through the shared
Appium client, the same interface every UI-automation target
provides. The
UI automation guide
explains why Jumpstarter uses Appium and how to set it up.
The exporter needs Appium and its
XCUITest driver, usually
pinned in the exporter’s container image; clients do not need Appium.
Jumpstarter does not build, sign, install or bundle
WebDriverAgent (WDA).
Appium reaches the device through the exporter’s own usbmux daemon (the
usbmux_socket, or usbmux_host for network transport) and every session is
pinned to the device’s udid and iOS version. Choose how WDA starts:
Attach to a running WDA with
wda_port, usually 8100. Start WDA with your device tools; Appium reaches it through a loopback forward on the exporter.appium: executable: /opt/appium/node_modules/.bin/appium home: /opt/appium/home wda_port: 8100
Let Appium launch an installed WDA by fixing the capabilities. On iOS 17 and later Appium launches it through a RemoteXPC tunnel, which the exporter host must allow; see the XCUITest driver’s documentation.
appium: capabilities: appium:usePreinstalledWDA: true appium:updatedWDABundleId: dev.example.WebDriverAgentRunner
capabilities, env, executable, home, startup_timeout and
max_upload_bytes are described in Appium Driver. Then, inside a lease:
from appium import webdriver
from appium.options.ios import XCUITestOptions
from jumpstarter.common.utils import env
with env() as root, root.ios.appium.serve() as target:
options = XCUITestOptions().load_capabilities(target.capabilities())
options.bundle_id = "com.apple.Preferences"
driver = webdriver.Remote(target.url, options=options, client_config=target.client_config())
try:
print(driver.page_source)
finally:
driver.quit()
j ios appium prints the endpoint, j ios appium -- COMMAND runs a command
with it in the environment, and j ios appium upload APP.ipa uploads an app
for appium:app. Appium sees every device on the exporter’s usbmux daemon but
sessions only reach the leased one; give each device its own exporter or
usbmux endpoint when tenants must not see each other’s devices.
To run Appium on the client instead, configure http_port for an
operator-started WDA and use HTTPS services for its URL
together with j ios serve for usbmux. On a Mac,
Appium through Device Hub starts a WDA build you
provide.
Security and limits¶
Exporter trust: The default mode keeps the real pairing identity on the exporter. Tools receive disposable credentials and establish TLS to the exporter through Jumpstarter. The exporter uses a separate TLS connection to the device and pins its certificate to the pairing record. Service streams are encrypted to the exporter even when the device service uses plaintext.
Bootstrap trust: Proxy credentials and HTTPS CAs arrive through Jumpstarter’s authenticated RPC channel. Their authenticity depends on that deployment; they do not independently protect against infrastructure that can replace the bootstrap metadata. Native TLS terminates at the trusted exporter, not at the device.
Device isolation: Discovery, pair-record reads and connections are scoped to the selected device on its USB link; a Wi-Fi copy of the same device is ignored. Pair-record writes are rejected; exporter mode also rejects client pairing changes.
Lease access: A lease grants full control of the device. The policy above protects the exporter’s pairing identity, not device capabilities: services started through lockdown, including the iOS 17.4+ CoreDevice tunnel, reach every service and TCP port on the device without further filtering.
forward_portsselects convenience forwards; it is not an access boundary. Reset or re-provision devices between untrusted tenants.Device Hub: The Mac pairs with an identity held by the exporter, not with the device, and reaches the device through the lease. Like other services, the tunnel gives the Mac full access to the device. Pairing a Mac happens inside a lease, and a paired Mac sees the device only while it holds a lease and runs
j ios devicehub. The link script makes the user’s account able to capture packets on every interface until the next reboot.Passthrough:
trust_mode: passthroughexposes the selected device’s real pairing record for tools that require direct device TLS. Use it only when credential sharing is acceptable. Opaque lockdown traffic cannot receive the exporter’s pairing-change policy, andhttp_portis unavailable in this mode.HTTP and raw ports: HTTPS for
http_portends on the exporter; its final USB connection uses HTTP. Rawforward_portsdo not gain native TLS.Service compatibility: Services that switch from TLS to plaintext after authentication, including legacy debugserver, instruments, accessibility and testmanager services, are rejected in exporter mode. The driver does not implement device actions or guarantee every external tool’s service support.
Lifetime: Reconnect after device detach. Pending service handles expire after 60 seconds and are single-use; active connections and pending handles are limited to 128 each. Disposable certificates expire after seven days; obtain a fresh lease for longer use.
Local simulators use the separate jumpstarter-driver-iossimulator package.
API Reference¶
Driver:
- class jumpstarter_driver_iosdevice.driver.IosDevice¶
One USB bench port, or one UDID on an operator-provided usbmux endpoint.
usb_portis a Linux sysfs name such as1-4.2. For a Mac exporter, select a device explicitly withudid. Network transport connects to a usbmux daemon, not directly to an iPhone’s IP address.
Client:
- class jumpstarter_driver_iosdevice.client.IosDeviceClient¶
- property appium: AppiumClient¶
The device’s Appium, when the exporter configures one; see the shared Appium client.
- connect(protocol: str | None = None, *, port: int = 0, usbfluxctl: str = 'usbfluxctl', idb: str = 'idb', timeout: float = 60.0) Generator[str, None, None]¶
Attach with the user’s usbfluxctl or idb and detach on exit.
The user installs and runs usbfluxd before attaching a usbmux endpoint. Cleanup also covers a timed out or failed attach, and stays bounded.
- devicehub(*, pair: bool = False) None¶
Show the leased device in Xcode’s Device Hub on this Mac until interrupted.
Only macOS clients are supported. Once per boot, Device Hub needs a virtual network link; when it is missing, this explains it and asks to create it with sudo, which prompts for the password. The first time a Mac uses a device, whenever the device is not listed in Device Hub (for example after Unpair), or with
pair=True, choose File > Pair Nearby Device… in Device Hub and type the code it shows when asked.
- devicehub_appium(xctestrun: str | PathLike, *, appium: str = 'appium', pair: bool = False, timeout: float = 180.0) Generator[AppiumTarget, None, None]¶
Show the device in Device Hub, run WebDriverAgent over its tunnel and Appium on this Mac.
xctestrunis the.xctestrunfile of a WebDriverAgent build signed for the device; Jumpstarter does not build or sign it. Xcode installs and starts it through the lease, so tests can be watched and debugged in Device Hub while they run.appiumis your installed Appium launcher, with its XCUITest driver. Yields the same target asappium.serve()on other devices, and sessions accept the same capabilities, with tokens from the target’s ownupload_app(): a gateway in front of Appium installs applications with devicectl (see thedevicehub_appiummodule). Itswda_urlis WebDriverAgent itself. Appium and WebDriverAgent stop, and the device becomes unavailable in Device Hub, when the context closes. Pairing works as fordevicehub().
- forward(port: int, *, local_port: int | None = None) Generator[str, None, None]¶
Forward an exporter-configured device port, binding only loopback.
The local port defaults to the device port; use zero for an unused port.
- https(*, port: int = 0) Generator[HttpsEndpoint, None, None]¶
Expose the configured HTTPS service with its public CA and metadata.
The client does not interpret provider metadata or configure tools. Closing the context removes its listener and CA files. The exporter owns service resources until lease teardown or reset.
- run(command: Sequence[str], protocol: str | None = None) int¶
Run a local command with its transport endpoint in the environment.
- serve(protocol: str | None = None, *, port: int = 0) Generator[str, None, None]¶
Serve a protocol on IPv4 loopback without invoking device tools.
The native protocol is the first one advertised by the target.
port=0selects an unused local port. The yielded endpoint is127.0.0.1:port.
HTTPS endpoint:
- class jumpstarter_driver_iosdevice.client.HttpsEndpoint¶
A verified HTTPS target and provider metadata, valid inside its context.
- environment(base=None) dict[str, str]¶
Copy tool environment and add public trust without disabling TLS.
Node keeps its built-in roots. Existing explicit Python CA bundles are extended, but unset Python trust variables stay unset: Python callers can use
ssl_context()or passca_fileto their SDK’s CA option.
- ssl_context() SSLContext¶
Add this endpoint’s CA to Python’s normal trust and hostname checks.