title: Command line "launch path not accessible"
body: <p>I recently found out that I can create Swift command line scripts.  </p>
  
  <p>I decided to see if I could build my Xamarin project using it. </p>
  
  <p>Unfortunately I am getting the following error and I don't know how to fix it. </p>
  
  <blockquote>
    <p>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible'</p>
  </blockquote>
  
  <p>Here is my script:</p>
  
  <pre><code>#!/usr/bin/env swift
  
  import Foundation
  
  print("Building Script")
  
  let fileManager = NSFileManager.defaultManager()
  let path = fileManager.currentDirectoryPath
  
  func shell(launchPath: String, arguments: [String] = []) -&gt; NSString? {
  
      let task = NSTask()
      task.launchPath = launchPath
      task.arguments = arguments
  
      let pipe = NSPipe()
      task.standardOutput = pipe
      task.launch()
  
      let data = pipe.fileHandleForReading.readDataToEndOfFile()
      let output = NSString(data: data, encoding: NSUTF8StringEncoding)
  
      return output
  }
  
  if let output = shell("/Applications/Xamarin\\ Studio.app/Contents/MacOS/mdtool", arguments: ["-v build", "\"--configuration:Beta|iPhone\"", "MyApp.iOS.sln"]) {
      print(output)
  }
  </code></pre>
  
  <p>Any thoughts?</p>