Lock or Sleep a Mac
5 ways to Lock (or sleep) your Mac - a simple way to prevent access when you walk away.
First, make sure the following is set:
- "Preferences ➤ Security & Privacy ➤ Require Password: immediately after sleep or screen saver begins".
You can select Sleep from the Apple Menu! But there are several other ways.

1. Shortcut: Lock
Use the following keyboard shortcut:
- Control + Shift + Eject
- or - on a Retina MacBook (with no eject key): - Control + Shift + Power
The screen will immediately blank, and tasks will continue to run in the background.
2. Shortcut: Sleep
Use the following keyboard shortcut:
- Command + Option + Eject
- or - on a Retina MacBook (with no eject key): - Command + Option + Power
The Mac will immediately goto sleep, and all tasks are suspended. Sleep will save battery power.
3. Lock with Keychain.
- Open Keychain Access, and access the Preferences.
- Check "Show keychain status in menu bar".
- Click the menubar Padlock, and select Lock Screen.

4. Lock with a Hot Corner
- Goto "Preferences ➤ Desktop & Screen Saver ➤ Hot Corners" and set a corner to "Put Display to Sleep."

Steer your mouse to the hot corner, and the screen will immediately blank. The Mac is locked.
5. Use the Power button!
With Mavericks (and Yosemite):
- Press the Power button for 2 seconds and release. The screen blanks.
- Press the Power button until a pop-up appears (3 seconds), select "Sleep".

Beware! Continuing to hold the Power button after the pop-up appears will force a power-down. Unsaved changes may be lost!
Lastly...
Caffeinated is a small menu-bar app which prevents your Mac from going to sleep, dimming the screen, or starting the screensaver. By default, a left-click will open the menu and a right-click (= secondary click) will toggle the activation state. This and other options can be changed in the menu settings.