<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSUserUnixTask",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUserUnixTask"
  },
  "title" : "NSUserUnixTask"
}
-->

# NSUserUnixTask

An object that executes unix applications.

```
class NSUserUnixTask
```

## Overview

The [`NSUserUnixTask`](/documentation/Foundation/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 [`Process`](/documentation/Foundation/Process), [`NSAppleScript`](/documentation/Foundation/NSAppleScript), or <doc://com.apple.documentation/documentation/Automator/AMWorkflow> classes.  If the application is sandboxed, then the script must be in the [`FileManager.SearchPathDirectory.applicationScriptsDirectory`](/documentation/Foundation/FileManager/SearchPathDirectory/applicationScriptsDirectory) 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`](/documentation/Foundation/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.

## Topics

### Executing the Unix Script

[`-  executeWithArguments:completionHandler:`](/documentation/Foundation/NSUserUnixTask/execute(withArguments:completionHandler:))

Execute the unix script with the specified arguments.

### Standard Unix Streams

[`standardError`](/documentation/Foundation/NSUserUnixTask/standardError)

The standard error stream.

[`standardInput`](/documentation/Foundation/NSUserUnixTask/standardInput)

The standard input stream.

[`standardOutput`](/documentation/Foundation/NSUserUnixTask/standardOutput)

The standard output stream.

### Constants

[`CompletionHandler`](/documentation/Foundation/NSUserUnixTask/CompletionHandler)

Implement this block to retrieve an error from the Unix scripted executed by [`execute(withArguments:completionHandler:)`](/documentation/Foundation/NSUserUnixTask/execute(withArguments:completionHandler:)).

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Sendable`](/documentation/Swift/Sendable)

### Inherits From

[`NSUserScriptTask`](/documentation/Foundation/NSUserScriptTask)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)