Give microphone permission programmatically

Hello,

I am setting up macMinis as CI machines (using gitlab-runner) for my team. We are developing mostly audio stuff, and some of our unit tests imply using audio inputs with AVAudioSession/AVAudioEngine.

These CI jobs trigger a microphone authorization pop-up on the macMinis, asking for permission to give gitlab-runner access to the microphone. Once the authorization is given, subsequent jobs run fine.

My issue is that the macMinis are updated on a regular basis with scripts, and since the path of the gitlab-runner binary, installed with homebrew, changes on every version, the pop-up is triggered again every time gitlab-runner gets updated. Since we are having more and more CI runners, maintaining this manually is becoming impossible.

Is there a way to either deactivate this security or scripting the authorization for a binary to access the microphone?

Thank you for your help!

Tom

I found this trick, which seems a very good lead. But unfortunately, I cannot edit the TCC.db file, even in sudo with SIP deactivated (on macMini M2, I did not check all machine types).

Give microphone permission programmatically
 
 
Q