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

# SecKeychainItemDelete(_:)

Deletes a keychain item from the default keychain’s permanent data store.

```
func SecKeychainItemDelete(_ itemRef: SecKeychainItem) -> OSStatus
```

## Parameters

`itemRef`

A keychain item object of the item to delete. You must call the `CFRelease` function to release this object when you are finished using it.

## Return Value

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

## Discussion

If the keychain item has not previously been added to the keychain, this function does nothing and returns `noErr`.

Do not delete a keychain item and recreate it in order to modify it; instead, use the [`SecKeychainItemModifyContent(_:_:_:_:)`](/documentation/Security/SecKeychainItemModifyContent(_:_:_:_:)) or [`SecKeychainItemModifyAttributesAndData(_:_:_:_:)`](/documentation/Security/SecKeychainItemModifyAttributesAndData(_:_:_:_:)) function to modify an existing keychain item. When you delete a keychain item, you lose any access controls and trust settings added by the user or by other applications.

---

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)