Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have switched from Windows to Mac and one of the things I need to set up properly is password management. Previously on Windows I was using a small TrueCrypt file containing text files with usernames and passwords.

I need to write an Applescript that takes those text files and imports them as Secure notes into Mac's Keychain Access app.

I know that there are some Applescript commands related to Keychain, but I haven't found a way to add Secure notes.

share|improve this question
up vote 1 down vote accepted

The Apple Developer area has some documentation referencing Keychain Services, which include a reference to Change the attributes and data in a keychain item (ex. notes) but I'm unable to find any calls for AppleScript outside of generating new login keys.

share|improve this answer
It's not Applescript but it is an API nevertheless. Thanks for the link. – Tomas Andrle Jan 11 '11 at 20:58

Given that you're new to the Mac, I'll suggest something that would solve your issue in an entirely different (and more Mac-like) way.

Your text files are usernames and passwords, right? So, they don't actually need to be notes; they could instead be stored as username & passwords, whether inside your Keychain or not.

If that's the case, I recommend skipping Keychain Access and instead going for 1Password. If you can get your current text files into a single CSV file, here's the instructions on how to import them.

share|improve this answer
Apart from this initial import there are no features in 1Password that I would miss with the default Keychain Access app. I'm trying to keep the number of 3rd party apps to a minimum, for now. – Tomas Andrle Aug 25 '10 at 8:54
@TomA - I think the way 1Password backs itself up to Dropbox is a killer feature, but that's just me. And then again, I also have an iPhone and iPad, so being able to update once on any device and have it sync everywhere automagically rocks my world. – Dori Aug 25 '10 at 20:30
@TomA - but separately: if I was correct that your text files are usernames and passwords, is there a reason you don't just use AppleScript to turn those files into passwords (versus notes)? And here's another option that might work for you: Keychain Access From Shell. – Dori Aug 25 '10 at 20:48
The text files were all created ad-hoc. Some contain additional notes, fragments of registration emails, etc. There's no fixed format apart from the fact that the filename is a domain name (so the Secure note "title" and "text" format would be ideal). Anyway, I'm probably going to just copy and paste the stuff by hand.. – Tomas Andrle Aug 25 '10 at 22:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.