title: Swift Execute command line command in Sandbox mode
body: <p>Currently I am trying to get my hands on Swift programming. I try to execute a command line command from within my <strong>macOS Swift application</strong>. Without setting my application being sandboxed everything is working fine. But since I activate the Sandbox the command will no longer work but does not throw any errors and terminates with status code <code>0</code>. </p>
  
  <p>So the simplest use case is to start <code>VSCode</code> from my application.</p>
  
  <p>The method which is responsible for executing the shell commands is the following:</p>
  
  <pre><code> func executeUserCommand(command: String, args: [String]?) -&gt; Int32{
          let task = Process()
          task.launchPath = "/usr/local/bin/" + command
          task.arguments = args
          task.launch()
          task.waitUntilExit()
          return task.terminationStatus
      }
  }
  </code></pre>
  
  <p>So if I want to start <code>VSCode</code> I call <code>executeUserCommand("code", ["."])</code> for opening <code>VSCode</code> in the current directory. </p>
  
  <p>This works fine until I enable the <code>App Sandbox</code> in Xcode. I clean and rebuild the application, but now <code>VSCode</code> does not start at all, but the terminationStatus is <code>0</code>. I am pretty sure that the sandbox restricts the access to the <code>/usr/local/bin</code> directory. </p>
  
  <p>Is there any way of giving my application access to only this specific folder ? So that the user can grant my application access to the folder once, and then the application can access the folder, even after a restart of the application ?</p>
  
  <p>Thanks in advance</p>