Running external binaries from Swift Package (TTS engine): Operation not permitted from Xcode app

Hi everyone,
We’re developing a macOS SwiftUI app that uses a local Swift Package (CasSherpaCore) to invoke an external compiled binary (sherpa-onnx-offline-tts) for text-to-speech synthesis using system calls. The package works flawlessly when tested from terminal or via a lightweight test C program.

However, when we invoke it from a SwiftUI app (even when Full Disk Access granted to Xcode and Terminal), we consistently get the error:

sh: /Users/xxxxxxxxxxx/SherpaONNX/sherpa-onnx/build/bin/sherpa-onnx-offline-tts: Operation not permitted

We’ve tried:

  • Granting Full Disk Access to Xcode and Terminal.
  • Removing the quarantine flag with xattr -d com.apple.quarantine.
  • Setting executable permission via chmod +x.
  • Using both system() and Process in C and Swift contexts.
  • Testing within a Swift Package that’s integrated into the app as a local dependency.
  • Running the command manually from terminal (works perfectly).

It appears that macOS (or Xcode’s runtime sandbox) is restricting execution of binaries from certain locations or contexts when launched via system() inside the app.

Questions:

  1. Is there a specific entitlement or configuration that allows execution of local binaries from a SwiftUI macOS app?
  2. Is this related to System Integrity Protection (SIP) or a hardened runtime limitation?
  3. Are there best practices or alternative approaches to safely execute local TTS binaries from within a Swift app?

Any help would be deeply appreciated. This is a core feature in our project and we’re stuck at this point. Thank you so much in advance!

Answered by Atrusplus in 848202022

This Post has been moved to the right Forum: App & System Services > Processes & Concurrency

Accepted Answer

This Post has been moved to the right Forum: App & System Services > Processes & Concurrency

Running external binaries from Swift Package (TTS engine): Operation not permitted from Xcode app
 
 
Q