The command line tool security set-keychain-settings provides options for

  • locking when the system sleeps (-l) and
  • locking after a timeout (-u)

but does not seem to provide any options for reversing these settings?

How to I use security set-keychain-settings to disable these options?

1 Answer 1


If you run security set-keychain-settings without anything else it will turn off both "Lock when sleeping" and "Lock after minutes of inactivity" for the 'login' Keychain. It will also set the default number of minutes back to 5.

From there you can turn on whatever settings you want.

  • That seems to work as far a settings go (the show as changed), but even if I security set-keychain-settings (no args) to keep my "Local Items" from locking, it insists on locking away, and the only way I can unlock it is with security unlock-keychain (no args).
    – orome
    May 21, 2018 at 16:27
  • That might be another problem entirely. Let me think on it. May 22, 2018 at 5:02
  • Thanks. Any help will be much appreciated. Happy to formulate a new question, but I'm not even sure what to ask. E.g I can get into states where unlock-keychain refuses correct passwords (often an "Allow" dialog is active) and I need to kill security_service (or reboot!) after which which unlock-keychain accepts passwords again.
    – orome
    May 22, 2018 at 15:03
  • I'm still stuck where I was on this. Any thoughts on how to proceed. (More details here.)
    – orome
    Dec 20, 2020 at 19:11
  • According to this doc: ss64.com/osx/security-keychain-settings.html omitting everything should disable the timeout as well: -t timeout Specify timeout interval in seconds (omitting this option specifies "no timeout")
    – emil.c
    Oct 4 at 8:42

You must log in to answer this question.

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