4

As far as I'm aware, passwd doesn't change the keychain password on Mac OS X. Is there a way to do this properly from the command line with a single command? If not, what about with multiple commands?

1 Answer 1

4

You can use security set-keychain-password:

$ security set-keychain-password
Old Password:
New Password:
Retype New Password:
$ 

The password and keychain can also be specified as arguments:

security set-keychain-password -o oldpassword -p newpassword file.keychain
3
  • Hmm, is the argument variant safe? I would be concerned about the passwords being visible e.g. in the output of ps auwwx.
    – zigg
    Dec 16, 2013 at 13:30
  • Thanks, that's what I was looking for. I assume, too, that you can use the keychain file argument with the interactive version. And I agree, the other version isn't as safe, Although for batch scripts it'd be more convenient.
    – jstm88
    Dec 16, 2013 at 14:53
  • Note: to get this method to persist after restart, you need to go to Keychain preferences and uncheck the boxes "Synchronize login keychain password with account" and "Set login keychain as default" (OS X 10.10)
    – xyz
    Jun 7, 2015 at 13:17

You must log in to answer this question.

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