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()
andProcess
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:
- Is there a specific entitlement or configuration that allows execution of local binaries from a SwiftUI macOS app?
- Is this related to System Integrity Protection (SIP) or a hardened runtime limitation?
- 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!