---
title: Process
framework: foundation
role: symbol
role_heading: Class
path: foundation/process
---

# Process

An object that represents a subprocess of the current process.

## Declaration

```swift
class Process
```

## Overview

Overview Using this class, your program can run another program as a subprocess and monitor that program’s execution. Unlike Thread, it doesn’t share memory space with the process that creates it. A process operates within an environment defined by the current values for several items: the current directory, standard input, standard output, standard error, and the values of any environment variables, inheriting its environment from the process that launches it. If there are any environment variables that should be different for the subprocess (for example, if the current directory needs to change), change it in the instance after initialization, before your app launches it. Your app can’t change a process’s environment while it’s running. You can only run the subprocess once per instance. Subsequent attempts raise an error. important: In a sandboxed app, child processes you create with this class inherit the sandbox of the parent app. Instead, write helper apps as XPC Services because it allows you to specify different sandbox entitlements for helper apps. For more information, see Daemons and Services Programming Guide and XPC.

## Topics

### Creating and initializing a process

- [run(_:arguments:terminationHandler:)](foundation/process/run(_:arguments:terminationhandler:).md)
- [init()](foundation/process/init().md)

### Returning information

- [processIdentifier](foundation/process/processidentifier.md)

### Running and stopping

- [run()](foundation/process/run().md)
- [interrupt()](foundation/process/interrupt().md)
- [resume()](foundation/process/resume().md)
- [suspend()](foundation/process/suspend().md)
- [terminate()](foundation/process/terminate().md)
- [waitUntilExit()](foundation/process/waituntilexit().md)

### Querying the process state

- [isRunning](foundation/process/isrunning.md)
- [terminationStatus](foundation/process/terminationstatus.md)
- [terminationReason](foundation/process/terminationreason-swift.property.md)

### Configuring a process

- [arguments](foundation/process/arguments.md)
- [currentDirectoryURL](foundation/process/currentdirectoryurl.md)
- [environment](foundation/process/environment.md)
- [executableURL](foundation/process/executableurl.md)
- [qualityOfService](foundation/process/qualityofservice.md)
- [standardError](foundation/process/standarderror.md)
- [standardInput](foundation/process/standardinput.md)
- [standardOutput](foundation/process/standardoutput.md)

### Working with termination handlers

- [terminationHandler](foundation/process/terminationhandler.md)

### Working with constants

- [Process.TerminationReason](foundation/process/terminationreason-swift.enum.md)
- [QualityOfService](foundation/qualityofservice.md)

### Working with notifications

- [didTerminateNotification](foundation/process/didterminatenotification.md)

### Working with notification messages

- [Process.DidTerminateMessage](foundation/process/didterminatemessage.md)

### Deprecated

- [launchedProcess(launchPath:arguments:)](foundation/process/launchedprocess(launchpath:arguments:).md)
- [currentDirectoryPath](foundation/process/currentdirectorypath.md)
- [launchPath](foundation/process/launchpath.md)
- [launch()](foundation/process/launch().md)

### Instance Properties

- [launchRequirement](foundation/process/launchrequirement.md)
- [launchRequirementData](foundation/process/launchrequirementdata.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Scripts and External Tasks

- [NSUserScriptTask](foundation/nsuserscripttask.md)
- [NSUserAppleScriptTask](foundation/nsuserapplescripttask.md)
- [NSUserAutomatorTask](foundation/nsuserautomatortask.md)
- [NSUserUnixTask](foundation/nsuserunixtask.md)
