<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ScriptingBridge",
  "identifier" : "/documentation/ScriptingBridge/SBApplication/applicationWithProcessIdentifier:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Scripting Bridge"
    ],
    "preciseIdentifier" : "c:objc(cs)SBApplication(cm)applicationWithProcessIdentifier:"
  },
  "title" : "applicationWithProcessIdentifier:"
}
-->

# applicationWithProcessIdentifier:

Returns the shared instance representing a target application specified by
its process identifier.

```
+ (SBApplication *) applicationWithProcessIdentifier:(pid_t) pid;
```

## Parameters

`pid`

The BSD process ID of a OSA-compliant application. Often you can get
the process ID of a process using the
<doc://com.apple.documentation/documentation/Foundation/Process/processIdentifier>
method of `NSTask`.

## Return Value

An instance of an `SBApplication` subclass that represents the
target application whose process identifier is `pid`. Returns `nil` if no
such application can be found or if the application does not have a
scripting interface.

## Discussion

You should avoid using this method unless you know nothing about a target
application but its process ID. In most cases, it is better to use
[`applicationWithBundleIdentifier:`](/documentation/ScriptingBridge/SBApplication/applicationWithBundleIdentifier:), which will dynamically
locate the application’s path at runtime, or
[`applicationWithURL:`](/documentation/ScriptingBridge/SBApplication/applicationWithURL:), which is not dependent on the target
application being open at the time the method is called.

## See Also

[`init?(processIdentifier: pid_t)`](/documentation/ScriptingBridge/SBApplication/init(processIdentifier:))

Returns an instance of an `SBApplication` subclass that represents the
target application identified by the given process identifier.



---

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)