I am trying to run a commandline tool using swift 2 on a mac (10.10):
let task = NSTask() task.launchPath = \"/path/to/wrong/binary\" task.launch() // NSPip
In Mac OS X High Sierra, launch() is deprecated. You would use run() instead:
launch()
run()
let process = Process() // ... do { process.run() } catch let error as NSError { print(error.localizedDescription) // ... }
Also have a look at the Apple Dev Docs