How to Take Screenshot by devicectl

I would like to use devicectl to take a picture of my iPhone screen on iOS 17. So far I have successfully performed,

  • Launching and exiting the app I created.
  • Reboot the iPhone connected via USB

etc.... I used to use libimobiledevice, but when I bought a new iPhone with iOS17, I can't do it anymore.

It seems devicectl doesn't support taking screenshots at this moment, unless it's a hidden command.

Closest you can get: xcrun devicectl device info details --device XXX -j ~/Downloads/details.json

Contains: "screenViewingURL" : "devices://device/open?id=XXX"

and { "featureIdentifier" : "com.apple.coredevice.feature.viewdevicescreen", "name" : "View Device Screen" }, is granted.

Not sure how to use that URL though...

And xcrun devicectl device info displays --device XXX -j ~/Downloads/displays.json

Contains:

"result" : {
    "backlightState" : "off",
    "current" : true,
    "displays" : [
      {
        "bounds" : [
          [
            0,
            0
          ],
          [
            1179,
            2556
          ]
        ],
        "currentOrientation" : "rot0",
        "displayId" : 1,
        "name" : "LCD",
        "nativeOrientation" : "rot0",
        "nativeSize" : [
          1179,
          2556
        ],
        "pointScale" : 3,
        "primary" : true
      }
    ]

But not a way to grab a screenshot from that display.

simctl on the other hand has simctl io booted screenshot

Maybe the copy command in combination with process launch can be used to launch a process that takes a screenshot and writes it to a path, then copy that file from the device.

But would be very helpful if Apple would add a screenshot argument to devicectl.

How to Take Screenshot by devicectl
 
 
Q