Shell Script That Requires Camera Access Doesn't Work

I have a KM micro that runs a shell script that simply executes videosnap, which is a CLI tool to record webcam video on Mac.

The command works fine when run directly in Terminal, which asks for the Camera and Microphone permission before executing for the first time.
But when it's run through Keyboard Maestro, it fails with the log "Execute a Shell Script failed with script error: text-script: line 1: 95799 Abort trap: 6"

After searching around, I think the issue is that keyboard maestro doesn't ask for the Camera permission even though it's a requirement for the script to run. I checked the list of apps allowed in the Camera section of the "Security & Privacy" system setting, KM doesn't show up there and there's no way to add it manually. There doesn't seem to be a way to add it unless KM asks for it somehow.

Any idea how to resolve this?

Hey @kbmfan,

Welcome to the forum!   :smile:

Scope out this thread:

If that doesn't help then touch base, and we'll look a little more.

-Chris

Thanks Chris for the quick response. Good to know that it's a known issue and will be resolved in the next version. Thanks!

Just so I understand the plan better, is the next version in the thread referring to version 10 or 9.x?

No idea.

@peternlewis?

This change was already released so it is in 9.2. So if the system is not adding Keyboard Maestro (or whatever else it needs to add to the preferences to allow the action), then I don't have any further solution to the problem I'm afraid. That would be a permission issue that Apple would need to resolve, or you would need to find a way to add Keyboard Maestro (or Keyboard Maestro Engine, or the script).

Although I just did double check and I only added the entitlement for the Keyboard Maestro Engine, so I have added it to Keyboard Maestro itself for the next version (which should be 9.x), maybe that will make a difference.

2 Likes

@kbmfan for me it works when I integrate the command in an AppleScript. The advantage is that no terminal window appears on the desktop when the KM macro is executed:

2021_04_03_Support_1

VideoSnap <4A33 210403T011234>.kmmacros (30,1 KB)

VideoSnap <4A33 210403T011234>

1 Like

Woah thanks a lot for the detailed reply even with a screencast!. This is the route I ended up taking.

1 Like

@kbmfan thank you for the tip with Videosnap.
I also installed ImageSnap to take snapshots when accessing my Mac's and autofill logins (1Password). Works great :+1: