accessing Keychain Access from terminal - OSX

You can deactivate the message by adding security to the list of applications allowed to access the entry inside Keychain Access.app:

enter image description here

You can also add an allowed application to an already existing item using the CLI (you will get a GUI box asking for confirmation though):

security add-generic-password -a ${USER} -s playground -T /usr/bin/security -U

-T is the path of the application you want to authorize and -U is to update entry if it already exists (what's called an "upsert" in some databases). (and playground is the name of my test entry).

See man security (or the online version) for further reference.


This is to protect your keychain from being accessed by a malicious script that might try to read it and mail it elsewhere.

If you say OK to the message it will not ask again (usually) so you only have to give it permission the first time.