This NSTask Tutorial for Mac OS X contains two NSTask examples, including executing programs, passing arguments, and displaying their output.
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2682-nstask-tutorial-for-mac-os-x