DEV Community

Apoorv Darshan
Apoorv Darshan

Posted on

Your Mac can screenshot a USB iPhone — Apple just hides the device

Plug an iPhone into a Mac and AVFoundation can see it as a real capture device — full resolution, actual framebuffer. The catch: Apple filters it out of the default device list.

The unlock is one CoreMediaIO property. Flip AllowScreenCaptureDevices on, re-enumerate, and the iPhone shows up as a .muxed AVCaptureDevice right next to your webcam:

var prop = CMIOObjectPropertyAddress(
    mSelector: CMIOObjectPropertySelector(kCMIOHardwarePropertyAllowScreenCaptureDevices),
    mScope: .global, mElement: .main)
var allow: UInt32 = 1
CMIOObjectSetPropertyData(CMIOObjectID(kCMIOObjectSystemObject),
    &prop, 0, nil, UInt32(MemoryLayout.size(ofValue: allow)), &allow)
Enter fullscreen mode Exit fullscreen mode

After that it's a plain AVFoundation pipeline:

  • Find the .muxed device in AVCaptureDevice.DiscoverySession
  • Run a capture session, grab one frame
  • Write native 1179x2556 to your folder, copy to clipboard

No AirPlay, no mirroring window, no compressed stream. It's the real thing the phone is rendering, captured instantly over the cable.

This is the USB mode of TetherShot — a tiny macOS menu-bar app. MIT, ships via npm, builds from source so there's no Gatekeeper warning.

npm install -g tethershot
Enter fullscreen mode Exit fullscreen mode

Code: https://github.com/apoorvdarshan/TetherShot

Top comments (0)