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


OSStatus SecCodeCopyStaticCode(SecCodeRef code, SecCSFlags flags, SecStaticCodeRef  _Nullable *staticCode);



A valid code object representing code running on the system.


Optional flags; see SecCSFlags and Code Signing Architecture Flags for possible values. Pass kSecCSDefaultFlags for standard behavior.


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


Use the 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 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

Working with Code Objects


Retrieves the location on disk of signed code, given a code or static code object.

Code Signing Architecture Flags

Use these supplemental flags to get static code.