In previous versions of OSX, I could use Ctrl Shift Power on my built in keyboard, or Ctrl Shift Eject on my (old) Apple bluetooth keyboard to lock the screen.

After upgrading to Sierra, that shortcut stopped working. Using Karabiner-EventViewer I discovered that pressing the built in power button triggers SysKey 0x6, and the Bluetooth keyboard Eject triggers no events.

Whats going on, and how can re-enable that shortcut?

  • How do you feel about shareware utilities? – Timothy Mueller-Harder Oct 3 '16 at 6:15
  • I had a similar problem with MacBook Pro (that has eject key on built-in keyboard) and a wired Apple keyboard. External keyboard's ctrl+shift+eject didn't do anything. Then I tried the same shortcut with the built-in keyboard, which worked—and, to my surprise, after this the shortcut worked also with the external keyboard! (Also I noted I had to hold the shortcut about 0,5 seconds longer than before.) Have you tried this? If it works, I can submit this as an answer… – Jari Keinänen Oct 3 '16 at 9:24
  • Just tried to press Ctrl + Shift + Power on built-in keyboard of my MBL15 and it locked the screen. However, I used to a shorter shortcut :) - Hot Corner: quickly put mouse cursor to down right corner (you can choose to your taste) and screen locks. – Denis Rasulev Oct 7 '16 at 13:03
  • Possible duplicate of Is there a quick way to lock my Mac? – Flimm Oct 2 '17 at 9:58

12 Answers 12

up vote 23 down vote accepted

There are different ways to lock your screen.

Note: These shortcut tips are for Sierra and below. In High Sierra, there is a new entry under the Apple Menu (with shortcut) to lock the screen.

1. Use keychain

Open keychain -> Settings. Choose from there Show keychain status in menu bar.

enter image description here

You can now choose from the menu bar to lock your screen.

enter image description here

With this option, you need your password to log in next time.

2. Use Hot Corners to lock your screen

First, go to your System Settings -> Desktop & Screen Saver and choose Hot Corners on the bottom right.

enter image description here

Next, choose one of the corners the option Put Display to Sleep. I prefer bottom right, but this is by each user different.

enter image description here

That's all. One note: You can configure in the Privacy Settings when the display will be locked. For example, if you have it set to five minutes, you need to enter your password after the time in your setting is gone. You can change this to immediately, for example.

enter image description here

3. Lock Screen (with Shortcut)

Because @Flimm asked for a shortcut to lock the screen, here is a solution below High Sierra.

Usually, there are two solutions. You can use CTRL+Shift+Power Button or

CTRL+Shift+Eject-Key to lock the screen.

Both solutions are not my favourites, and for that reason, I've created a Shell Script with Automator. Thanks to Taylor who gave me this hint.

  1. Open Spotlight and type Automator to open the Application.
  2. Create a new Document.
  3. Choose Service to make as global Service.
  4. On the left Pane, choose Utilities; and on the right column, double-click Run Shell Script. You see a Window with the Cat-Command.
  5. Delete the cat-Command and copy & paste the following Shell-Script into the empty Window:

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

Make sure that on the top right of the Automator-Window, both pull down-menus are set as no input in any application.

  1. Click on the top right to the Run-Button (marked with green circle) and test if it works.
  2. Save your workflow now as Lock Screen, for example.
  3. Open System Preferences, Keyboard and click on the Button Shortcuts or Keyboard Shortcuts.
  4. Choose on the Left columns Services and search for your saved workflow.
  5. Add your favourite Shortcut (e.g. I have Cmd + Alt/Opt + L).

For better understanding, I have put the pictures below.

enter image description here

enter image description here

Apple Support Documents Mac Keyboard Shortcuts

  • How to open that keychain? – Askar Jun 9 '17 at 8:39
  • Type in Spotlight keychain and hit Enter. Or choose from the Finder-Menu -> Go To -> Utilities and open from there keychain. – dante12 Jun 19 '17 at 20:57
  • There's a Keychain Access.... – Askar Jun 20 '17 at 0:05
  • It's not clear what do you mean. Have you problem to Access your keychain? Maybe this help you: support.apple.com/kb/PH20094?locale=de_DE&viewlocale=en_EN – dante12 Jun 20 '17 at 5:34
  • 1
    @iosdude, You don't need this in High Sierra. There is a Lock Screen menu option in the apple menu (works globally). – chrish Jan 29 at 21:26

In macOS High Sierra (10.13) there is a 'Lock Screen' option built in the Apple menu.

And finally a shortcut ctrl + cmd + Q :-)

Lock Screen in Apple Menu

  • 6
    Thank you for pointing this out! I've only been running 10.13 for a couple of days and this one change has made the upgrade worthwhile. :) – Richard Hurt Sep 27 '17 at 17:11
  • Thanks for sharing the combination, just realized ^ is actually ctrl (new to mac) – I.G. Pascual Jan 30 at 11:17
  • And that funny-looking branch thing is Option. Took me a while to figure that out. (: – seaturtle Feb 28 at 0:04

If you have a 2016 or later MacBook Pro with Touch Bar, you can assign one of the Touch Bar virtual keys to lock the Mac. It's under System Preferences/Keyboard and use the "Customize Control Strip…" button.

  • Thank you; I couldn't find this anywhere else and it's so much easier than the alternatives! – user1717828 May 3 '17 at 21:08

You can setup a keyboard shortcut of your choice by creating a Service using Automator.

  1. Open Automator (Cmd ⌘Space then enter Automator).
  2. Create a new Service.
  3. In the left pane, pick UtilitiesRun Shell Script (or use the search field), and drag it into the Actions pane (the right one).
  4. Just above that action, select Service receives no input in Any Application.
  5. Enter "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession" -suspend as the text of your shell script (be sure to include the quotes).
  6. Save your service and give it a name.
  7. Open System PreferencesKeyboardShortcutsServicesGeneral (at the very bottom of the list).
  8. Make sure the service you’ve just created is checked/enabled.
  9. Click none to assign a keyboard shortcut to it.

Now try your keyboard shortcut. You'll be kicked to the login screen. It might appear as though this logs you out, but it does not.

The service is also accessible from the Menu BarApplication NameServices. I think the very first time I set it up, I actually had to click it from there before the keyboard shortcut worked, but that might have been a fluke.

If you prefer to sleep your display instead of locking the screen, use pmset displaysleepnow as the shell script. This will put your display to sleep, though in that case your screen will only lock after the set timeout specified under System PreferencesSecurityGeneral. You could even go crazy and setup both services.

  • If you're a developer who is already using a shell, you can skip the whole Automator thing: osx_logout() { "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession" -suspend } – WuTheFWasThat Feb 2 '17 at 18:10
  • @WuTheFWasThat although, since it doesn't actually log you out, I wouldn't call it 'osx_logout'... :) – David May 30 '17 at 6:39
  • If it doesn't work and you use a non-standard shell (e.g. zsh) it might help to set the shell for the script explicitly to /bin/bash in automator. At least it did in my case. – David May 30 '17 at 6:48
  • Indeed, had to set shell to /bin/bash, default of /bin/false did not work. – NeilenMarais Jul 10 '17 at 13:34
  • Why is it disconnecting my VPN? if I use the native combination Ctrl+shift+power on my air sierra it's not disconnecting at all but with this shell command is... I just want the equivalent of Windows+shift+L that we have on windows to leave my desk and protect with password my screen but let everything just intact on background. :( – Pabluez Aug 11 '17 at 15:03

Hold down the power button for about a half second. This will sleep the computer. If you have it set to lock when the computer sleeps, you're good to go. However, if you hold it down too long, it will ask to restart the computer.

Edit: As ingenious stated, some keyboards do not have a power button. In that case, attempt to locate a sleep button or try another method.

Sleep button

  • 2
    there is no power button on the external (usb/bluetooth) apple keyboards. – ingenious Oct 20 '16 at 5:30

You could use Hammerspoon and define a key binding/shortcut. I use

hs.hotkey.bind({"cmd", "alt"}, "S", function()
      hs.caffeinate.startScreensaver()
end)

in my ~/.hammerspoon/init.lua sequence to bind Option+Command+S to the screen saver; that I have set to "Require a password immediately after sleep or screen saver begins" in System Preferences → Security & Privacy. You can also use

hs.caffeinate.lockScreen() 

but I prefer the screen saver approach. See the Hammerspoon docs for all the automation magic it enables.

You can put your mac to sleep with ⌘ command + option + ⌽⏻.

Before that, have the setting as shown in the screenshot below.

System Preferences > Security & Privacy

Works for me on macOS Sierra!

  • The Unicode character used in the third button doesn't display for me. Is it meant to be the power symbol? – Flimm Sep 29 '17 at 17:01
  • @Flimm Yes! That's what it is, the power button. – mangatinanda Oct 3 '17 at 10:33

Apple removed has removed this shortcut for security purposes & due to issues with bluetooth connectivity.

You can utilize Hot Corners as a work-around.

System Preferences>Desktop & Screen Saverenter image description here

You get to choose what hot keys trigger the action
When I hold down Command and drag my mouse to top left corner, my computer locks it's screen.

  • Can you please clarify something? Is this only for Bluetooth keyboards? For example, if I upgrade my MBP and do Control+Shift+Eject on the wired or built-in keyboards, would that lock the screen, and would Control+Option+Command+Eject on those keyboards shut it down? Also, would that second keyboard shortcut work over a Bluetooth keyboard? Also can you confirm if any duration is needed to hold those keys to perform either shortcut? Personally I don't use the Control+Shift+Eject shortcut often, but I always use Control+Option+Command+Eject and this question and this answer has me worried. – kal-al Oct 11 '16 at 2:17

I am currently using a MacBook Pro that's running MacOS Sierra, version 10.12.4. Coming from a Windows and Ubuntu background, I found it odd that a Mac doesn't have an easy shortcut for locking the computer. However, what worked for me are these steps:

  1. Go to System Preferences >> Security & Privacy.

  2. Choose the General tab.

  3. Set your Mac to require a password immediately the screensaver starts or your computer wakes from sleep.

  4. Finally, whenever you want to lock your computer, just press the key combination of Ctrl + Shift + Power button.

In macOS Sierra 10.12.6, I used the Keychain Access application > Preferences > Show Keychain Access in menu bar.

I've just upgraded to macOS High Sierra 10.13.1 and that preference is no longer there.

Thanks to @pjc90 above, I now know about the "Lock Screen" option in the Apple menu, and the keyboard shortcut (finally) "Command ⌘ + Control ⌃ + Q".

I needed this and was able to accomplish it with the following Apple Script inside of a shell script that does some other stuff, but this should be all you need:

osascript <<EOD
        tell application "System Events"
                key code 12 using {control down, command down}
        end tell
EOD

To lock screen:

press control + Command + Q

  • Also you can change the shortcut from control + Command + Q maclovin.org/blog-native/2017/… – Amit Jan 22 at 4:47
  • 3
    How does this differ from other answers which have given this shortcut and more information? – Mark Jan 22 at 10:55

protected by Tetsujin Jan 22 at 16:39

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.