Lock your screen

Press ⌃⌘Q (Control-Command-Q) to lock the screen instantly, or use Apple menu → Lock Screen. Your apps keep running; your password brings you back.

Without Terminal

  1. Press ⌃⌘Q.
  2. Or Apple menu → Lock Screen.

In one command

Set how soon a password is needed after the screen sleeps: System Settings → Lock Screen → “Require password after screen saver begins or display is turned off”.

Or just ask Titan
Lock my screen when I say I’m stepping away. Do it with Titan

Titan is an AI that lives on your computer: tell it what you need and it does it while you watch — you press Return, nothing runs by itself. What is Titan?

Titan isn’t on this computer yet. Get Titan, then press the button again — the task will be waiting, typed in.

Related

Keep your computer from going to sleep