Access macOS built-in camera from a launch daemon

I have a launch daemon (via launchd) that requires access to the macOS built-in camera to do some video processing using OpenCV. Since macOS Catalina (I believe in Mojave also), my launch daemon has no access to the camera at all. No security prompts - nothing at all.

I tried the same trick as I did for "Input Monitoring": Pack the daemon in an app-like structure, whitelist the camera in harden runtime, and run the daemon's code as an application. In that case, I do have a security prompt as expected and my code works with the camera. Also, I get my application listed under "Privacy" - "Camera".

Unfortunately, whenever I try to launch the same binary as a daemon using launchd, I get no access to the camera. No matter whether my daemon-application was added before under "Privacy" - "Camera" or not. The approach above worked with "Input Monitoring" but not with the camera (for "Input Monitoring" I launched the daemon as an app to whitelist it first and launched it later via launchd).

Is that a bug? Or launch daemons are not allowed to access the camera in macOS Catalina in any case? Any ideas?

Replies

I’m sorry to so that there’s no supported way to make this work, because camera access is based on an array of frameworks that are not daemon safe.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"