Dump iCloud keychain in Terminal

I failed to find the path to iCloud keychain to do just security dump-keychain - the iCloud keychain isn't shown when I try security list-keychains. What is the path to that keychain (or, if it cannot be obtained, how to dump the whole iCloud keychain)?

Or, maybe, Apple Script could help to do that?


Solution 1:

iCloud Keychain is stored on disk in a different format than a traditional keychain ref1, ref2. It's located at ~/Library/Keychains/ in a folder named as a long UUID. You can see the modified timestamp change on the contents of that folder as you change something in your iCloud keychain.

Whilst you can use AppleScript and Usable Keychain Scripting to work with the system and login keychains, there's no way to access the iCloud keychain.

So the only option you're left with is to AppleScript GUI operation of the Keychain Access app.

Solution 2:

So I've been trying to figure out something similar for about a year or so - and at this point, I'm willing to say that without super ninja magic it's really not possible to do this using the 'security' command. I have seen countless questions without an answer.

Although there is no actual confirmation its impossible there seems to be a preponderance of evidence suggesting it is not possible.