Usable Keychain Scripting For Lion
July 29th, 2011I’m tracking down a mysterious behavior of Safari in Lion, where it seems to fail to enter my password for logins that I’ve saved to the keychain. In the process of looking into this, I noticed that “Keychain Scripting” has mysteriously disappeared from Lion. As far as I can tell you must copy Apple’s scripting addition from Snow Leopard in order to keep using it.
On the other hand, I wrote an alternative years ago, called Usable Keychain Scripting. Its main advantage over Apple’s implementation is that it is (or at least, was) enormously faster. Today I updated the app to be 64-bit compatible and to fix a pernicious bug in which the password value returned for a keychain item would sometimes have garbage appended to the end of it.
Download Usable Keychain Scripting 1.0b4
This is not a supported product, and your success with it may vary. But it has been very handy in the past for me, and hopefully it will come in handy for you if you need to script the keychain.
July 29th, 2011 at 4:39 pm
This is exactly what I need. My homemade username/password scripts stopped working in Lion. I didn’t want to download the SL version of keychain scripting. I’ll try your solution over the weekend. Thanks for this. My passwords are auto generated and I have no idea what they are.
July 29th, 2011 at 5:58 pm
Thanks, James. I hope it works well for you.
July 31st, 2011 at 9:25 pm
Any idea why a script like this doesn’t work?
tell application “Usable Keychain Scripting”
unlock keychain “Open.keychain”
end tell
July 31st, 2011 at 9:32 pm
@Robert – It looks like Usable Keychain Scripting is using the full path name of the keychain as its name. This doesn’t seem like a great thing for it to do, but you can work around the problem by referring to the target keychain by its full path e.g.:
tell application “Usable Keychain Scripting”
set kcPath to (POSIX path of (path to home folder as string)) & “Library/Keychains/Open.keychain”
unlock keychain kcPath
end tell
August 1st, 2011 at 5:45 am
So glad I found this. Am still using Snow Leopard but the old Usable Keychain Scripting would place an extra character onto my passwords about 50% of the time and I couldn’t figure out why. This version seems to have stopped the problem.
Thanks Daniel!
August 6th, 2011 at 4:11 pm
Daniel,
Your Usable Keychain Scripting app works very well and is almost direct replacement for the Leopard version. And it is many times faster. I’m quite pleased that my home-grown password system is working again.
Thank you very much.
James
August 6th, 2011 at 4:14 pm
James, great to hear. I am glad it’s working out for you!
August 8th, 2011 at 4:17 pm
Hi Daniel,
I can’t seem to write a new password to a generic item in my login keychain.
I use “set password to _string” inside the generic item’s tell block. There are no errors but the password doesn’t change. Am I doing something wrong?
Thank you for writing this!
Morten
August 8th, 2011 at 5:11 pm
Hi Morten – unfortunately Usable Keychain Scripting doesn’t support writing to the keychains. I originally wrote the scripting addition as a workaround for Apple’s insanely slow Keychain Scripting, so it only made sense to address the reading. It also made me feel a little safer about sharing something that works with such sensitive data, that it would only do reading and no writing.
That said, with the omission of Keychain Scripting from Lion, it might make sense to bite the bullet and add writability to it.
Daniel
August 9th, 2011 at 12:32 pm
Thanks for the answer Daniel.
I hope you will bite that bullet. And if you do, I’d be happy to pay for the product. Unless I’m mistaken there’s no easy way to bulk change a lot of passwords on Lion right now.
Thanks again for all your work.
August 9th, 2011 at 1:16 pm
Hi Morten – you may want to take a look at Apple’s command line “security” tool, I haven’t looked too closely but it offers a lot of similar functionality to what an AppleScript interface does, and may allow you to mass-update items.
November 13th, 2011 at 3:38 am
Hi, I’m glad this is here. I can’t believe Apple doesn’t allow us to export. Ugh.
Anyway, I downloaded this .dmg and can’t open it in Apple Script or open it like other .dmg files. What have I missed?
Thanks
November 13th, 2011 at 7:28 am
Hi Vic – I don’t know what system you are running on. I just verified I can download and open the dmg on Mac OS X 10.7. I assume it still works on 10.6 as well but can’t guarantee other OS’s.