I am working on a blog post about this, but I'd like to ask for some feedback / suggestions from the Keyboard Maestro folks before I draw wider attention to this.
As you may know, there is no way to backup or export your "iCloud Keychain".
security command-line tool cannot access iCloud Keychain entries, and you cannot use AppleScript in Keychain Access.app to access iCloud Keychain entries either.
There are many forum posts, etc. which suggest creating a new local keychain and then copying items from the iCloud Keychain to the local keychain; however, this no longer seems to work.
When I tried it, Keychain Access repeatedly asks for a password, but fails to copy the items. I tried it on Mojave, High Sierra, and even El Capitan, but it failed on all of them. YMMV, of course, but I needed another alternative.
My method is rather "brute force" but a fairly simple Keyboard Maestro macro.
Before the macro can be run, a few steps must be taken:
- Launch Keychain Access.app
- Select the "iCloud Keychain" from the column on the left
- Select one of the items from the iCloud Keychain (main part of the window) and either double-click on it or press Enter/Return to open the item in its own window.
- You must enter your login password into the macro where indicated. (see below)
Once you have that window open, you can run the macro, which will copy all of the information for that one item, then close the window, select the next item, and open it in its own window, ready for the macro to be run again. Repeat for each item in the iCloud Keychain.
Items are saved to a plain text file at ~/Downloads/iCloudKeychain.csv
Regarding #4 above: unfortunately, for every password that you want to copy from the iCloud Keychain, you will be asked for your login password to authorize access to the iCloud Keychain. I know putting your password into a Keyboard Maestro macro is not ideal, but I'm not aware of another way to do it reliably. If you are concerned about this, I recommend changing your account password temporarily, then putting the temporary password into the macro, and changing your account password back again after you have finished with the macro.
If that whole idea puts you off wanting to test this out, I understand.
Keyboard Maestro 8.2.4 “Export or Backup iCloud Keychain from Keychain Access” Macro