---
title: "xcrun devicectl commands for a real iPhone | Mobster"
description: "The xcrun devicectl commands for a real iPhone, from Xcode's own help. List devices, install and launch apps, copy files, read JSON with jq, fix the errors."
canonical: "https://mobster.dev/blog/devicectl-commands"
last-updated: "2026-11-14"
---

The xcrun devicectl commands for a real iPhone, from Xcode's own help. List devices, install and launch apps, copy files, read JSON with jq, fix the errors.

# Control an iPhone from Terminal with xcrun devicectl

22 October 2026

`devicectl` is Apple’s command line for CoreDevice, the device stack that came with Xcode 15 and iOS 17. It installs, launches and inspects apps on an iPhone without opening Xcode, and it writes JSON a script can read. Every command and flag below comes from the help of devicectl 518.27, the version in Xcode 26.4. The output is from an iPhone 16 on iOS 18.3.1, with its identifiers replaced.

## Check that you have it

```
xcrun -f devicectlxcrun devicectl --version
```

```
/Applications/Xcode.app/Contents/Developer/usr/bin/devicectl518.27
```

If `xcrun` answers `unable to find utility "devicectl"`, check which Xcode installation your command-line tools use. Select an installation of Xcode 15 or later:

```
sudo xcode-select -s /Applications/Xcode.app
```

On our Mac, every devicectl command first printed two lines, `Failed to load provisioning paramter list due to error: ... "No provider was found."` and `devicectl manage create` may support a reduced set of arguments.`, and then ran and exited 0. Both go to stderr, so `2>/dev/null` hides them.

## Find the iPhone

```
xcrun devicectl list devices
```

It prints one row per device it knows, with five columns: Name, Hostname, Identifier, State and Model. Pick the columns you want with `--hide-default-columns` and `--columns`:

```
xcrun devicectl list devices --hide-default-columns --columns Name --columns State --columns Model
```

```
Name     State                Model------   ------------------   ----------------------iPhone   available (paired)   iPhone 16 (iPhone17,3)
```

The State column says what devicectl can do with each device right now:

- `connected`: a tunnel to the phone is open.
- `available (paired)`: the phone is paired and reachable, with no tunnel open. The next command that needs it opens one, and prints `Acquired tunnel connection to device.`
- `unavailable`: the phone was paired once and can’t be reached now.

Every command that acts on a phone takes `--device` (`-d`). It accepts the Identifier column, the ECID, the serial number, the UDID, the phone’s name or its DNS name. Use the Identifier. A name has to match exactly. A curly apostrophe (`’`) in a name does not match a typed `’`.

`--filter` takes an NSPredicate over the column names or the JSON field names:

```
xcrun devicectl list devices --filter "hardwareProperties.marketingName == 'iPhone 16'"
```

`--columns '*'` prints every column, and `--hide-headers` drops the header rows.

### The Identifier isn’t the UDID

The Identifier is CoreDevice’s own UUID, in the form `XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX`. `xcodebuild -destination id=...` and `xcrun xctrace list devices` use the UDID, in the form `XXXXXXXX-XXXXXXXXXXXXXXXX` on recent iPhones. The UDID is in the JSON (see [Read JSON](#read-json-not-the-table)):

```
xcrun devicectl list devices -q --json-output devices.jsonjq -r '.result.devices[] | select(.connectionProperties.pairingState == "paired") | [.identifier, .hardwareProperties.udid] | @tsv' devices.json
```

## Read the phone’s details

```
xcrun devicectl device info details --device <identifier>
```

```
Current device information:• identifier: <identifier>▿ hardwareProperties:    • deviceType: iPhone    • marketingName: iPhone 16    • platform: iOS    • productType: iPhone17,3    • reality: physical    • udid: <UDID>▿ deviceProperties:    • bootState: booted    • ddiServicesAvailable: true    • developerModeStatus: enabled    • name: iPhone    • osBuildUpdate: 22D72    • osVersionNumber: 18.3.1▿ connectionProperties:    • pairingState: paired    • transportType: localNetwork    • tunnelState: connected
```

That is a trimmed excerpt; the full answer also lists the hardware, the hostnames and the phone’s capabilities. It took 4.9 s, including opening the tunnel. Three fields answer most setup questions:

- `developerModeStatus` says whether Developer Mode is on, without picking up the phone.
- `ddiServicesAvailable` says whether the Developer Disk Image services are mounted. devicectl turns them on when a command needs them, and prints `Enabling developer disk image services.`
- `transportType` is `localNetwork` when the tunnel runs over Wi-Fi, as it did here.

Two more read the phone’s state:

```
xcrun devicectl device info lockState --device <identifier>
```

```
Current device lock state:• deviceIdentifier: <identifier>• passcodeRequired: true• unlockedSinceBoot: true
```

`passcodeRequired: true` means the phone is locked now. A UI test can’t drive a locked screen, so check this before a run.

```
xcrun devicectl device info displays --device <identifier>
```

```
Current Displays:▿ 1: LCD (primary):    • bounds: (0.0, 0.0, 1179.0, 2556.0)    • currentOrientation: rot0    • pointScale: 3Main display backlight state: backlight is offMain display orientation: portrait, non-flat orientation: portrait, orientation not locked
```

## Install, launch and stop an app

### Install a build

`device install app` takes an `.app` bundle signed for the phone. Build one for a device, then install it:

```
xcodebuild -scheme YourApp -destination 'generic/platform=iOS' -derivedDataPath build buildxcrun devicectl device install app --device <identifier> build/Build/Products/Debug-iphoneos/YourApp.app
```

### List the apps on it

```
xcrun devicectl device info apps --device <identifier>
```

```
Apps installed:Name      Bundle Identifier     Version   Bundle Version-------   -------------------   -------   --------------YourApp   com.example.yourapp   1.0       1
```

By default it lists only apps a developer installed. `--include-default-apps` adds Apple’s, `--include-app-clips` adds App Clips, `--include-all-apps` lists everything, and `--bundle-id <id>` lists one app.

### Launch it

```
xcrun devicectl device process launch --device <identifier> com.example.yourapp
```

- `--terminate-existing` stops a running copy of the app first.
- `--console` connects the app’s stdout and stderr to your terminal and waits for it to exit. It needs Xcode 16 or later.
- `--payload-url <url>` hands the app a URL to open as it launches, such as a deep link.
- `-e '<json>'` (`--environment-variables`) sets environment variables, as a JSON object of strings.
- `--start-stopped` launches it suspended, waiting for a debugger.
- `--no-activate` launches it without bringing it to the foreground.

Any arguments after the bundle ID go to the app. You can also set environment variables in your shell with the `DEVICECTL_CHILD_` prefix, and the app gets them without it. `-e` replaces those.

```
DEVICECTL_CHILD_API_BASE=https://staging.example.com \  xcrun devicectl device process launch --device <identifier> --terminate-existing --console com.example.yourapp
```

### Stop it

`device process terminate` takes a process ID, not a bundle ID. List the processes, find the app’s, then stop it:

```
xcrun devicectl device info processes --device <identifier> -q --json-output processes.jsonpid=$(jq -r '.result.runningProcesses[] | select(.executable | contains("/YourApp.app/")) | .processIdentifier' processes.json)xcrun devicectl device process terminate --device <identifier> --pid "$pid"
```

The process list is long: 450 processes on this phone, from `launchd` at PID 1 to SpringBoard. Each one is an executable path:

```
PID     Executable Path-----   ----------------------------------------------------------34      /System/Library/CoreServices/SpringBoard.app/SpringBoard67      /usr/libexec/backboardd
```

`terminate` sends SIGTERM; add `--kill` for SIGKILL. The same family has `signal --signal <name>`, `suspend`, `resume` and `sendMemoryWarning`, which sends your app a memory warning on real hardware.

### Uninstall it

```
xcrun devicectl device uninstall app --device <identifier> com.example.yourapp
```

## Copy files to and from an app

The file commands name a domain and, for an app’s container, the bundle ID. The domains are `temporary`, `appDataContainer`, `appGroupDataContainer` and `systemCrashLogs`.

List what’s in the app’s Documents folder:

```
xcrun devicectl device info files --device <identifier> \  --domain-type appDataContainer --domain-identifier com.example.yourapp --subdirectory Documents
```

Pull a database off the phone:

```
xcrun devicectl device copy from --device <identifier> \  --domain-type appDataContainer --domain-identifier com.example.yourapp \  --source Documents/app.sqlite --destination ./app.sqlite
```

Push a fixture onto it:

```
xcrun devicectl device copy to --device <identifier> \  --domain-type appDataContainer --domain-identifier com.example.yourapp \  --source ./fixtures/app.sqlite --destination Documents/app.sqlite
```

`copy to` skips files that haven’t changed and takes `--source` more than once. For a directory, `--remove-existing-content true` clears the destination first.

## Read JSON, not the table

devicectl’s help says the printed table is for people and can change between releases. The supported interface for a script is the file `--json-output` (`-j`) writes. Add `-q` to keep the table off your terminal.

```
xcrun devicectl device info lockState --device <identifier> -q --json-output lock.json
```

```
{  "info": {    "commandType": "devicectl.device.info.lockState",    "jsonVersion": 3,    "outcome": "success",    "version": "518.27"  },  "result": {    "deviceIdentifier": "<identifier>",    "passcodeRequired": true,    "unlockedSinceBoot": true  }}
```

That’s trimmed: `info` also holds the arguments and the environment. When a command fails, it exits 1, `info.outcome` is `failed`, and an `error` object holds the `code`, the `domain` (`com.apple.dt.CoreDeviceError`) and `userInfo.NSLocalizedDescription`.

Stop a script when the phone is locked:

```
jq -e '.result.passcodeRequired == false' lock.json >/dev/null || { echo "Unlock the iPhone first" >&2; exit 1; }
```

List the paired iPhones with their name, model, iOS version and tunnel:

```
jq -r '.result.devices[]  | select(.hardwareProperties.platform == "iOS" and .connectionProperties.pairingState == "paired")  | [.deviceProperties.name, .hardwareProperties.marketingName, .deviceProperties.osVersionNumber, .connectionProperties.tunnelState]  | @tsv' devices.json
```

```
iPhone	iPhone 16	18.3.1	disconnected
```

Some devices in the list have no name. A `test()` on one stops jq with `null (null) cannot be matched, as it is not a string`, so give it a default: `select((.deviceProperties.name // "") | test("iPhone"))`.

Pass `--timeout` (`-t`) in scripts, too. A listing or a launch can hang while CoreDevice brings up a tunnel, and `-t 30` makes the command fail after 30 s instead of waiting.

## The errors, and what fixes them

**`xcrun: error: unable to find utility "devicectl", not a developer tool or in PATH`.** Check which Xcode installation your command-line tools use. Run `sudo xcode-select -s /Applications/Xcode.app`.

**`ERROR: The specified device was not found. (Name: ...) (com.apple.dt.CoreDeviceError error 1000 (0x3E8))`.** The `--device` value matched nothing. Copy the Identifier from `xcrun devicectl list devices`. A typed name usually fails on the curly apostrophe.

**`ERROR: CoreDeviceService was unable to locate a device matching the requested device identifier. (DeviceIdentifier: ...) (com.apple.dt.CoreDeviceError error 1011 (0x3F3))`.** The phone is paired but out of reach: its State is `unavailable`. Plug it in, or put it on the same network as the Mac, unlock it and run the command again.

**`ERROR: The specified operation is not implemented on this device. (com.apple.dt.CoreDeviceError error 1 (0x01))`** from `process launch --console`. `--console` needs Xcode 16 or later.

**`jq: error ... null (null) cannot be matched, as it is not a string`.** A device in the list has no name. Use `(.deviceProperties.name // "")`.

## devicectl and the older tools

- **ios-deploy** doesn’t work with iPhones on iOS 17 or later from Xcode 15 on. `device install app` and `device process launch` replace it.
- **libimobiledevice** (`idevice_id`, `ideviceinstaller`, `idevicesyslog`) still lists, installs and streams logs over the cable. devicectl 518.27 has no command that streams the phone’s log, so `idevicesyslog` or Console still does that job.
- **`xcrun xctrace list devices`** prints names, iOS versions and UDIDs. On our Mac it listed the iPhone 16 under “Devices Offline” while devicectl listed it as `available (paired)`. Trust devicectl’s State.
- **`xcrun simctl`** is the same kind of tool for simulators. devicectl is for real devices.

## Where Mobster fits

Mobster calls devicectl for the same jobs: it installs your build on a USB iPhone with `device install app`, reads the apps on the phone with `device info apps` before a check, and reads `lockState` over USB or Wi-Fi. The screen itself is driven by WebDriverAgent, which [device setup](https://docs.mobster.dev/device-setup) installs for you. Setup on a previously unused iPhone 16 took 5 min 26 s from install to helper ready, excluding Trust and Developer Mode.

Then `mobster test --device <phone>` runs your saved checks on the phone. Mobster checks their assertions ([testing](https://docs.mobster.dev/testing)). [Test an iOS app on a real iPhone from your Mac](https://mobster.dev/blog/test-ios-app-on-real-iphone) walks through it from the cable, and [the AI agent guide](https://mobster.dev/blog/test-ios-app-real-iphone-ai-agent) shows an agent writing the checks.

[Get Mobster for Mac](https://mobster.dev/download). It sets up your iPhone and runs `mobster test` on it: [free](https://mobster.dev/pricing) on any number of iPhones (AI runs on a supported AI plan, an API key or a model on your Mac).

## Questions

- ### What is xcrun devicectl?
  Apple's command line for CoreDevice, the device stack that came with Xcode 15 and iOS 17. It lists devices, installs, launches and stops apps, copies files into app containers and reads device details, all without opening Xcode.
- ### Does devicectl replace ios-deploy?
  For install and launch, yes. ios-deploy doesn't work with iPhones on iOS 17 or later from Xcode 15 on, and devicectl does both jobs with flags for a console, environment variables and a launch URL.
- ### How do I get JSON from devicectl?
  Pass --json-output with a file path. devicectl writes info (the command, its version and the outcome) and result (the data) to that file. Its help says the file is the only supported interface for scripts; the printed table can change between releases.
- ### Why does devicectl say the specified device was not found?
  The --device value matched no phone. A name has to match exactly, including any curly apostrophe (’) in it. Copy the Identifier column from xcrun devicectl list devices instead.

## Sources

- [Apple Developer Forums: devicectl is new in Xcode 15 (DTS answer)](https://developer.apple.com/forums/thread/739340)
- [Apple Developer Forums: devicectl --console arrives in Xcode 16 (DTS answer)](https://developer.apple.com/forums/thread/756393)
- [React Native CLI #2610: replace ios-deploy with xcrun devicectl](https://github.com/react-native-community/cli/issues/2610)
- [Appium forum: devicectl launch and process listing hang on iOS 17 with Xcode 15](https://discuss.appium.io/t/hang-issue-when-creating-sessions-on-ios-17-devices-with-xcode-15/45696)
- [Mobster docs: device setup](https://docs.mobster.dev/device-setup)

## Try it on your own iPhone

Download Mobster for Mac

## More from the blog

### [Test an iOS app on a real iPhone from your Mac](https://mobster.dev/blog/test-ios-app-on-real-iphone)

17 Oct 2026

### [USB and Wi-Fi for iPhone automation](https://mobster.dev/blog/iphone-automation-usb-vs-wifi)

13 Oct 2026

### [Test your iOS app end to end on a real iPhone with an AI agent](https://mobster.dev/blog/test-ios-app-real-iphone-ai-agent)

27 Oct 2026
