title: Executing shell commands with NSTask - Objective-C Cocoa
body: <p>I have been searching for days and hours for this, I have seen a lot of examples of this, but cannot figure out how <strong>NSTask</strong> works, let's say I wanted to execute the command <code>killall Dock</code>
  or <code>defaults write com.apple.Finder AppleShowAllFiles YES</code> something like that, how would I go about doing this.</p>
  
  <p>I know how to execute an external shell script (sh) but need to be more sophisticated and use NSTask instead.</p>
  
  <p>Thanks for any help!!</p>