Hi, I'm working on an app that uses git command. When I enabled sandbox, it works when the app is run within Xcode. When I run the app manually, it shows error:
xcrun: error: cannot be used within an App Sandbox.
Here is sample code to reproduce the problem:
let task = Process()
task.launchPath = "/usr/bin/env"
task.arguments = ["git", "--version"]
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe
task.launch()
task.waitUntilExit()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
let alert = NSAlert()
if let output = String(data: data, encoding: .utf8) {
alert.messageText = output
} else {
alert.messageText = "***"
}
alert.runModal()