On this page
zsh terminal, macOS

macOS Keychain Access quirk why you can’t delete items from the UI

Learn why you can't delete items from macOS Keychain UI and how to fix it.

You have an entry in your keychain that you want to delete. When you right-click the item and select Delete… from the context menu, the item remains in the keychain and is not removed.

Why can’t you delete a keychain item even after selecting Delete… from the context menu?

macOS Keychain Access with "github" text in the search field.

Workaround for deleting keychain items

When using the Keychain Access application, you may encounter a bug that prevents you from deleting items after searching for them.

To work around this issue, find the item in the list without using the search function, then delete it.

How can I remove an item from Keychain Access using the command line?

You can remove an item from Keychain Access using the command line with the security command. The basic steps are:

  • Open Terminal: You can find Terminal in your Applications folder under Utilities or by searching for it with Spotlight.
  • Identify the item: Before deleting an item, you may want to locate it first. Use the following command to find the specific item you want to delete. Replace item_label with the label of the item you are looking for (e.g., the name of a password or service):

    security find-generic-password -l "item_label"

    This command displays the details of the item, confirming its existence in the keychain.

  • Delete the item: Once you have confirmed the item you want to delete, use the following command to remove it. Replace item_label with the actual label of the item:

    security delete-generic-password -l "item_label"

    If you are deleting an internet password, use:

    security delete-internet-password -l "item_label"
  • Verify deletion: To ensure the item has been successfully removed, run the find command again:

    security find-generic-password -l "item_label"

    If the item has been deleted, this command should return an error indicating that the item could not be found.

  • Delete an entire keychain: To delete an entire keychain, use the command:

    security delete-keychain "keychain_name.keychain"
Be cautious when deleting items or keychains as this action is irreversible unless you have backups.

Related posts

Comments

Leave a Reply

Search in sitelint.com

Audit and debug pages with browser extension

Boost your website’s quality by auditing your page with SiteLint, a chromium-based extension that improves accessibility, quality, technical SEO, and provides easy-to-understand reports to help you prioritize and fix issues.