Passwords on OS X via security

Paul W. Rankin hello at
Wed Nov 12 11:33:37 GMT 2014

I've just started using offlineimap and it is the greatest. It's gold
Jerry, gold!

I'd love to use an "elegant one-liner" (i.e. no pythonfile) to retrive
my account password, which is stored in a local OS X keychain. The
following content of my ~/.offlineimaprc is not successful:

--8<---------------cut here---------------start------------->8---
[Repository Remote]
type = IMAP
remotehost =
remoteuser = user at
remotepasseval = `security find-generic-password -a user at -s -w`
--8<---------------cut here---------------end--------------->8---

nor any of these...

--8<---------------cut here---------------start------------->8---
remotepasseval = "`security find-generic-password -a user at -s -w`"
remotepasseval = "`security find-generic-password -a user at -s -w` | tr -d '\n'"
remotepass = `security find-generic-password -a user at -s -w`
remotepass = `security find-generic-password -a user at -s -w | tr -d '\n'`
--8<---------------cut here---------------end--------------->8---

etc. etc.

It's not the password. I've tested by copying the output of the
`security` command and pasting into .offlineimaprc and everything Just
Works (but obviously with real values).

So how to I succesfully call the `security` command from .offlineimaprc?

Thanks for your time :)

Paul W. Rankin

More information about the OfflineIMAP-project mailing list