17

So far my project had been relying on the following commands in order to tweak screensaver settings:

defaults write com.apple.screensaver askForPasswordDelay 0
defaults write com.apple.screensaver askForPassword true

As of macOS High Sierra (10.13) it seems like these settings are no longer stored in com.apple.screensaver

I'd like to avoid Apple Script to achieve such thing, any suggestions?

Lee Andrew
  • 798
  • 7
  • 28
  • 2
    This question is off topic here, you should post it on Ask Different - the Stack Overflow Apple forum – Trent Sep 28 '17 at 05:23

2 Answers2

3

Victor Vrantchan explains this in a great blog post here:

https://blog.kolide.com/screensaver-security-on-macos-10-13-is-broken-a385726e2ae2

In summary you cant query but you can mange.:

Until Apple resolves this bug, screensaver security/lock settings must be managed carefully. More specifically:

  • Enforce the profile ASAP, during initial bootstrap.
  • Make sure the askForPasswordDelay key is used in the profile.
Community
  • 1
  • 1
Mike Dodge
  • 31
  • 3
1

Using defaults write no longer works as of 10.13.

http://www.openradar.me/35462422

You can use this gist to accomplish it using profiles instead: https://gist.github.com/mcw0933/21b8a9e292e83c69931f5de0d2ae1883

mcw
  • 3,500
  • 1
  • 31
  • 33
  • Thanks for sharing! If I use the profile as-is (only replacing my username) I always get askForPasswordDelay set to "immediately", even though the default value seems to be 5 (seconds?) and no matter what other int value I set it to. How can I actually set a time, e.g. 5 seconds? On macOS 10.14.6 – Gandalf Saxe Aug 23 '19 at 21:35
  • 1
    Ah so this only happens if I install via install.sh, profile installs under "User Profiles", whereas opening `askforpassworddelay.mobileconfig` directly makes it work as expected, and gets installed under "Device Profiles". `sudo install.sh` however installs it correctly :) So problem solved. – Gandalf Saxe Aug 23 '19 at 21:45
  • Oh, nice! Yes - you do want it installed under Device Profiles. I can't explain why the script in my gist does so for me, but not for you. Glad to know `sudo` worked for you. – mcw Aug 27 '19 at 14:34