I have 41 webform password items stored in Keychain. Each item has the same password (since each of them is a different wifi router in our building).

Every few months, I need to update all of these items to reflect the new password set up our sys admin. Is there a quick terminal script that I can use to batch update the password of any item whose name contains "10.18.124." from "oldpw" to "newpw"?


This should be possible with security(1).

The command should like something like this:

security add-generic-password -a -w "newpw" -j "Password Updated 2017-05-17 12:04" -U
  • -a Specify account name (required)
  • -w Specify password to be added
  • -j Specify comment string (optional)
  • -U Update item if it already exists

I don't think there is a "contains" feature so you maybe have to loop this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .