Looking into using the command line tool for KeyChain. I am able to do a lot of the things through security; listing my multiple keychains, dumping them and setting defaults. Reading through tutorials and other postings I expect to find my passwords with
security find-generic-password test
But I get
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
This won’t work in my default keychain or login.keychain. However, I am able to find my passwords listed as ‘internet’ with find-internet-password command. Can anyone explain why or what I am doing wrong? Sites I’ve been reading is the man page and http://blog.macromates.com/2006/keychain-access-from-shell/,
Generic passwords are identified by their Service and Account attributes. For example, to search for a password for account “bar” of the “foo” service, use
The
-goption displays the value of the password at the end of the output.The combination of service and account is guaranteed to uniquely identify a particular password. Other queries (comment, label, etc.) are possible, but they may match multiple passwords.
find-generic-passworddisplays only the first single matching item, which limits its usefulness for such queries.