How can I find my saved Instagram web password in Terminal?

Let say I've saved my Instagram password for the account "xxx". I know I could find this password using Keychain Access, but is there a way to do this in Terminal?

I've tried things like:

security find-internet-password -gs www.instagram.com

but this didn't yield the password.


Solution 1:

The name you need to pass to security find-internet-password is the name shown in Keychain Access, either from the Name column of the entry or the title shown at the top of the Keychain Access window when the entry is selected.

You can also search through the keychain directly by running

security dump-keychain | grep -i instagram

PS: In my case the result was

$ security dump-keychain | grep -i instagram
    0x00000007 <blob>=0xx...xxx  "instagram.com (Passwords\302\240not\302\240saved)"
    "srvr"<blob>="instagram.com"

with some Unicode characters mingled into the Name field (which explains why find-internet-password wasn't able to find a match).