title: How to execute a unix executable file with Swift
body: <p>I developing a OS X application with swift. I need to use some library on my application. The library is a Unix executable file.
  I can execute the Unix executable file on terminal.</p>
  
  <p>This is example:</p>
  
  <pre><code>pngquant --quality=65-80 test.png
  </code></pre>
  
  <p>But I need execute the Unix executable file on OS X application. I don't know how to do it.</p>
  
  <p>I think should execute command on OS X application, and find an awesome library to execute the command.</p>
  
  <p>Using <a href="https://github.com/Swiftline/Swiftline" rel="nofollow noreferrer">swiftline</a> example:</p>
  
  <pre><code>let result = run("ls -all")
  print(result.stdout)
  </code></pre>
  
  <p>Print content:</p>
  
  <pre><code>total 0
  drwxr-xr-x  6 DevinShine  staff  204 Dec 23 22:18 .
  drwxr-xr-x@ 3 DevinShine  staff  102 Dec 23 22:16 ..
  drwxr-xr-x  3 DevinShine  staff  102 Dec 23 23:25 Pion.app
  drwxr-xr-x  4 DevinShine  staff  136 Dec 23 22:18 Pion.swiftmodule
  drwxr-xr-x  7 DevinShine  staff  238 Dec 23 22:18 Pods.framework
  drwxr-xr-x  7 DevinShine  staff  238 Dec 23 22:18 Swiftline.framework
  </code></pre>
  
  <p>I copy Unix executable file to Build Phases.</p>
  
  <p><a href="https://i.stack.imgur.com/xeJEC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xeJEC.png" alt="look picture"></a></p>
  
  <p>But I don't know how to move Unix executable file to OS X application and execute it.</p>
  
  <p>Please help me,thx.</p>