I’m trying to write a utility to help automate some things with simctl. My thought was to write a quick command-line application in Swift, using the Task API to launch things, but it appears that due to App Sandboxing (I’m on 10.15) I can’t actually launch an executable in /usr/bin:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible'
I tried creating an Entitlements file to disable the sandbox, but this didn’t work:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<false/>
</dict>
</plist>
What I’m trying to write is a developer tool with no plans of distribution. Is there a way to write a Swift app that launches software like this locally, or has this been completely locked down with this iteration of macOS?
Last reply, because I’m an ***** and didn’t see the exectuableURL property the first time through:
let process = Process()
process.executableURL = url
process.arguments = ["test"]
process.launch()
process.waitUntilExit()
This works fine, and crucially lets me use Process, so I can terminate the running process.