Error opening serial port

Some thoughts about application sandboxing

Encouraged by the latest developments, today I started building a new application that will  allow remote connection to Kenwood TH-D74, remote control and APRS data transfer. However, while building and running the app I got the following error:

Error opening serial port … Operation not permitted(1).

If you encounter this, be aware that it is generated by application sandboxing. You can think of using App Sandbox entitlements as a two-step process:

  1. Sandbox a target, which removes most capabilities for interacting with the system
  2. Restore capabilities to the sandboxed target, as needed, by configuring App Sandbox entitlements

At runtime, if a target requires a capability or a system resource for which the target isn’t entitled, the sandbox daemon (sandboxd) logs a violation message to the console. You get this in more detail here. But it does not tell you exactly where to configure entitlements and chances are this might create some confusion. It turns out that the value to use for any of these keys is a Boolean YES or NO, with the default value in each case being NO and specifically for interaction with serial devices, the key to be used is

Select your target and edit the <target>.entitlements file adding the key as boolean and the value YES.

And the result:

Succesfully opened serial port /dev/cu.TH-D74YO3ITI-SerialPort.
Current input baud rate is 9600
Current output baud rate is 9600


Filed in Apple Programming, Blog, Serial and tagged , , . Bookmark the permalink.

Lasă un răspuns

Adresa ta de email nu va fi publicată. Câmpurile obligatorii sunt marcate cu *