Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a virtual display on macOS, programmatically

I am looking for the ability to create a virtual display on macOS, preferably using Electron/Node.js or native macOS development if that's the only resort.

I would like to create a virtual display that functions just like a real one, can be re-arranged etc.

Basically, imagine what happens when you plug in an HDMI cable into your computer - exactly the same.

I looked into:

  • screen (Electron)
  • Quartz Display Services (Apple Developer)
  • AVCaptureDevice (Apple Developer)

But couldn't find any useful information - it's mostly read-only.

like image 425
Ariel Weinberger Avatar asked Sep 11 '25 12:09

Ariel Weinberger


1 Answers

There is undocumented API in CoreGraphics to create virtual displays. It works as one can expect, from Objective-C, based on the API (dumped in https://github.com/w0lfschild/macOS_headers/tree/master/macOS/Frameworks/CoreGraphics/1348/ ). At least in macOS 10.15, no idea about macOS 11. But, as mentioned, it is undocumented and will thus possibly change without warning or might cause the machine to crash if used incorrectly.

like image 73
tml Avatar answered Sep 14 '25 02:09

tml