Require Password Immediately After Sleep or Screensaver

Use sysadminctl -screenLock immediate to lock the Mac as soon as the screen saver starts or the display sleeps.

macOSlockscreensecuritysysadminctlMedium risk
Run `sudo sysadminctl -screenLock immediate -password -` (enter your admin password when prompted) to demand the login password instantly on wake.

01Command

Command
$ sudo sysadminctl -screenLock immediate -password -

02What it does

By default macOS can be set to allow a grace period before asking for the password; 'immediate' removes it so the screen locks the instant the display sleeps or the screensaver kicks in. This is the command-line equivalent of System Settings > Lock Screen with the delay set to 'Immediately'. The `-password -` syntax makes sysadminctl prompt securely instead of taking the password as a visible argument. Use `-screenLock off` to revert.

03Risk

RiskMedium risk
RequirementsRequires an administrator password; you will be prompted to type it after the dash (`-password -`).
!Warning: With 'immediate', the screen locks the moment it sleeps — anything unsaved on screen is behind the login prompt when you return.

04Undo

Undo
$ sudo sysadminctl -screenLock off -password -

05Sources

Last verified: 2026-09-18 · Category: Security & Privacy

06Related solutions