<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecCodeCopyStaticCode(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecCodeCopyStaticCode"
  },
  "title" : "SecCodeCopyStaticCode(_:_:_:)"
}
-->

# SecCodeCopyStaticCode(_:_:_:)

Returns a static code object representing the on-disk version of the given running code.

```
func SecCodeCopyStaticCode(_ code: SecCode, _ flags: SecCSFlags, _ staticCode: UnsafeMutablePointer<SecStaticCode?>) -> OSStatus
```

## Parameters

`code`

A valid code object representing code running on the system.

`flags`

Optional flags; see [`SecCSFlags`](/documentation/Security/SecCSFlags) and [Code Signing Architecture Flags](/documentation/Security/code-signing-architecture-flags) for possible values. Pass [`kSecCSDefaultFlags`](/documentation/Security/SecCSFlags/kSecCSDefaultFlags) for standard behavior.

`staticCode`

On return, a static code object representing the code in the file system that is the origin of the code specified by the `code` parameter.

## Return Value

A result code. See [Code Signing Services Result Codes](/documentation/Security/code-signing-services-result-codes).

## Discussion

Use the [`SecCodeCopyPath(_:_:_:)`](/documentation/Security/SecCodeCopyPath(_:_:_:)) function to get the URL specifying the location on disk of the code represented by a code or static code object.

Many functions in the Code Signing Services API take either a static code object or a code object as an input parameter. For these functions, if you pass in a code reference, the function first translates it to a static code reference in the same manner as the [`SecCodeCopyStaticCode(_:_:_:)`](/documentation/Security/SecCodeCopyStaticCode(_:_:_:)) function. In each such case, the parameter description documents this behavior.

### Special Considerations

The link established by this function is generally reliable but is not guaranteed to be secure.

## See Also

[`SecCodeCopyGuestWithAttributes(_:_:_:_:)`](/documentation/Security/SecCodeCopyGuestWithAttributes(_:_:_:_:))

Asks a code host to identify one of its guests given the type and value of specific attributes of the guest code.

[`SecCodeCopyHost(_:_:_:)`](/documentation/Security/SecCodeCopyHost(_:_:_:))

Retrieves the code object for the host of specified guest code.

[`SecCodeCopySelf(_:_:)`](/documentation/Security/SecCodeCopySelf(_:_:))

Retrieves the code object for the code making the call.



---

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)