Mac Developer Library

Developer

Foundation Framework Reference NSUserUnixTask Class Reference

Options
Deployment Target:

On This Page
Language:

NSUserUnixTask

The NSUserUnixTask class is intended to run unix applications, typically a shell script, from your application. It is intended to execute user-supplied scripts, and will execute them outside of the application's sandbox, if any.

The class is not intended to execute scripts built into an application; for that, use one of the NSTask, NSAppleScript, or AMWorkflow classes. If the application is sandboxed, then the script must be in the NSApplicationScriptsDirectory folder. A sandboxed application may read from, but not write to, this folder.

If you simply need to execute unix scripts without regard to input or output, use NSUserScriptTask, which can execute any of the specific types. If you need specific control over the input to, or output from, or the error stream of the script, use this class.

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.8 and later.
  • The standard error stream.

    Declaration

    Swift

    var standardError: NSFileHandle?

    Objective-C

    @property(retain) NSFileHandle *standardError

    Discussion

    Setting to nil will bind the stream to /dev/null.

    The default is nil.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

  • The standard input stream.

    Declaration

    Swift

    var standardInput: NSFileHandle?

    Objective-C

    @property(retain) NSFileHandle *standardInput

    Discussion

    Setting to nil will bind the stream to /dev/null.

    The default is nil.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

  • The standard output stream.

    Declaration

    Swift

    var standardOutput: NSFileHandle?

    Objective-C

    @property(retain) NSFileHandle *standardOutput

    Discussion

    Setting to nil will bind the stream to /dev/null.

    The default is nil.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

Data Types