Hi,
I have an Electron app that I build, sign, notarize, and staple using electron-builder. It includes Sound Exchange (SoX), which I was invoking from the homebrew installed version. It builds a dmg and works fine.
However, my users are non-technical, thus cannot be expected to install dev tools, homebrew, and sox from the command line and set paths.
Therefore, I need to include a SoX binary in my app. I have a static SoX binary that works. However, when I try to run it from my electron app, I get Error: spawn / <path>/sox EACCES
.
Electron-builder is signing the SoX binary codesign --sign <sign number> --force --timestamp --options runtime --entitlements dist/entitlements/entitlements.mac.plist /<app path>Contents/Resources/bin/sox/sox
The app sign/notarize works fine, the dmg mounts, and the app runs until I try to invoke SoX. Also, I verified the sox binary and entire app are signed and the app staple is valid. I am running the app from /Applications.
Please help me!
That error message suggests that you’re trying to run the tool as a child process. If so, there are a couple of things to watch out for here:
-
You have to be careful about the entitlements you claim. The tool will inherit its sandbox from your app, and thus you typically only want
com.apple.security.app-sandbox
andcom.apple.security.inherit
. I talk about this more in Embedding a command-line tool in a sandboxed app and Resolving App Sandbox Inheritance Problems. -
It’s best not to embed your tool in
Contents/Resources
. See Placing Content in a Bundle and Embedding nonstandard code structures in a bundle
Having said that, the specific error you’re getting, EACCES
, suggests that you have a BSD privileges issue, not a sandbox issue. I talk about that more in On File System Permissions. Check that, in the built app, the executable has the execute permission bit set and that all directories up the chain are both readable and executable.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"