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

# SecKeychainGetPath(_:_:_:)

Determines the path of a keychain.

```
func SecKeychainGetPath(_ keychain: SecKeychain?, _ ioPathLength: UnsafeMutablePointer<UInt32>, _ pathName: UnsafeMutablePointer<CChar>) -> OSStatus
```

## Parameters

`keychain`

A reference to a keychain whose path you wish to obtain.

`ioPathLength`

On entry, a pointer to a variable containing the length (in bytes) of the buffer specified by `pathName`.

    On return, the string length of     `pathName`    , not including the null termination.

`pathName`

On entry, a pointer to a buffer that you have allocated. On return, the buffer contains POSIX path of the keychain as a null-terminated UTF-8 encoded string. The function returns [`errSecBufferTooSmall`](/documentation/Security/errSecBufferTooSmall) if the provided buffer is too small to hold the string with the null terminator byte.

## Return Value

A result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes).

## Discussion

---

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)