Very tricky. I have a lot more respect for the Keychain in Mac OS X after working on this. It is not simple at all. After poking around I cobbled together an Automator application (using AppleScript) that goes through the Keychain and exports the passwords to a file named keychain_passwords.txt on your Desktop. The bulk of the programming kudos goes to baltwo in the Apple Discussion Boards.
Ensure that Keychain Scripting.app is in /System/Library/ScriptingAdditions/ and that the
login.keychain is in /Users/username/Library/Keychains/.
Note that a big downside to this is that you have to click ‘Allow’ for each password access and (maybe intentionally) the popup window that asks for the permission is in a slightly different spot on the screen each time so you can’t just click madly- you have to aim and click almost every time. But this was the only thing I could find.
For those that have trouble finding Keychain Scripting.app, Apple decide to remove it in Lion. You can copy the Snow Leopard version to this path, if you have this OS lying around, or use this http://www.red-sweater.com/blog/2035/usable-keychain-scripting-for-lion . (N.B. both options are untested, as I gave up after clicking the dialogue box for 10 minutes, only to realise I was about 1/3 through!)
As suggested here: http://stackoverflow.com/questions/717095/is-there-a-quick-and-easy-way-to-dump-the-contents-of-a-macos-x-keychain , a better solution is to use terminal.app and type in “security dump-keychain -d login.keychain > ~/Desktop/keychain.txt” (without the quotes). The output format might be a bit “weird”, and you still have to click once for each keychain entry, but the dialogue boxes seem to be much more consistently positioned. I found it much quicker for my 100+ entries!
How do you use the output of dump-keychain -d on linux? Or is this tip only for Mac-to-Mac migration?
Unfortunately Phil, I think all of these solutions just get your passwords out- there’s no magic import into Linux.