Skip to main content
1 of 2
Andrew J. Brehm
  • 2.5k
  • 12
  • 40
  • 59

Disable screensaver password requirement from command line

I am trying to enable and disable the screensaver password requirement from the command line.

defaults read com.apple.screensaver

shows a variable askForPassword set to either 0 or 1, depending on whether I configured a password requirement in System Preferences or not.

defaults write com.apple.screensaver askForPassword 1

and

defaults write com.apple.screensaver askForPassword 0

enable and disable the password setting, or so I thought.

What I find instead is that the commands indeed check and uncheck the checkbox in System Preferences under Security but do not affect the screensaver at all.

If I enable the password in System Preferences and then disable it using the second defaults write command, the checkbox in System Preferences is unchecked, but the screensaver will still ask for a password. Only checking and unchecking the checkbox in System Preferences can change this behaviour now.

And if I disable the password in System Preferences and then enable it using the first defaults write command, the checkbox in System Preferences is checked, but the screensave won't ask for a password. Only unchecking and checking the checking the checkbox in System Preferences changes the behaviour afterwards.

What's going on?

I can imagine that this is a global setting and I should modify /Library/Preferences/com.apple.screensaver instead of the user domain. But in that case, why is there an effect on the System Preferences checkbox?

Andrew J. Brehm
  • 2.5k
  • 12
  • 40
  • 59