macOS command line utility vs. CoreBluetooth permissions (iTerm)

Viewed 234

I'm writing a command line tool for macOS which interfaces with BLE devices. I have a problem with regards to permissions:

If I launch my tool on the command line, it gets killed by the OS. Only if I launch it via the debugger, the graphical alerter comes up to allow the bluetooth permission.

My plist that contains the NSBluetoothAlwaysUsageDescription key is embedded as __TEXT __info_plist in the binary. Is this no longer enough for a command-line tool to access security-guarded OS facilities these days?

1 Answers

Ok, right after setting up the bounty, it occurred to me that all command line apps inherit their permissions from iTerm (which is what I'm using). Granting Bluetooth permission to iTerm makes it just work.

I'd like to slightly adjust the bounty then… is it possible that my command line program can detect this lack of (inherited) permission, thus preventing the crash and rather showing an instruction alert instead?

Related