Subscribe to MacYourself via RSSFollow MacYourself on Twitter

How to lock your Mac screen with a keyboard shortcut

How to lock your Mac screen with a keyboard shortcut

When you need to temporarily leave your Mac unattended, it’s a hassle to put it to sleep and wake it up again. What’s the quickest way? Set up a simple keyboard shortcut that shows your Mac’s login screen without logging you out.

Mac users have a bunch of different ways to prevent others from snooping on their Mac when they need to step away for a few minutes. Some like to set up a hot corner that starts their screensaver. Others like to click a menu bar icon that turns off their display. There are even some 3rd party apps that add this functionality. The problem with these approaches is that they cut off some background processes or require system preferences to be configured a certain way. These seem like workarounds rather than real solutions.

An even better way to lock your Mac’s screen is to press a quick keyboard shortcut that instantly shows a login screen without closing any of the things you were working on. It requires just a couple minutes to set up initially – here’s how:

Lock Screen Service

  1. Launch Automator from your Applications folder.
  2. Select “Service” as the document type.
  3. Select “Utilities” from the list on the left, then double-click “Run Shell Script” in the next column.
    Lock Mac screen with keyboard shortcut
  4. On the top-right side of the screen, adjust the drop-down menus so the statement reads: “Service receives [no input] in [any application]”
  5. Copy the following command into the large text box that appears:

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

    Lock Mac screen with keyboard shortcut
  6. Go to File > Save and name your service “Lock Screen”. Once saved, you can now quit Automator.

Lock Screen Keyboard Shortcut

  1. Launch System Preferences and go to the Keyboard pane.
  2. Next, select the “Keyboard Shortcuts” tab. From the list on the left, select “Application Shortcuts”. Click on the plus (+) button below to add your new shortcut.
  3. In the dialog box we’ll want to leave “All Applications” selected in the first menu. Enter “Lock Screen” as the Menu Title. Please note this has to be exactly the same name you entered when saving the service in Automator. Finally, enter your keyboard shortcut. Let’s go with Command+Shift+L.
    Lock Mac screen with keyboard shortcut
  4. Click Add and you’re all done!

Now when you press your keyboard shortcut (Command+Shift+L), the Mac login screen will immediately be displayed. You’re still technically logged in and processes such as large downloads will continue in the background. But you can leave your Mac unattended without worry – no one will be able to access your account until you enter your password. When you do, everything on your desktop will be there just as you left it!

59 Comments Have Been Posted (Leave Your Response)

Why it disables my wireless adapter? Or at least drops my wifi connection? Also second screen goes disconnected!

[…] kaynak : http://www.macyourself.com/2013/01/27/how-to-lock-your-mac-screen-with-a-keyboard-shortcut/ […]

Brilliant. Works with Yosemite. Much faster than reaching under the login name in the finder bar and selecting login window menu (if you ever bothered to actually display your login name there).
Cool tip thanks

You’ve gone to a lot of effort to implement a feature that’s already built-in to macOS (and OS X before that).

Just press Shift-Control-Power on the built-in keyboard of any MacBook, MacBook Air, or Macbook Pro.

If you’re using an external Apple keyboard, press Control-Shift-Eject.

This instantly locks the Mac screen.

Murali Srinivasan
February 1st, 2017, 5:49 AM

@Steven J Klein, both keyboard shortcuts ‘Control-Shift-Eject’ and ‘Shift-Control-Power’ just blacks out the screen and they don’t lock the machine which is not safe in my opinion.

@Murali, the built-in keyboard short-cut works as intended if you also change the System Preferences > Security & Privacy > Require password to ‘immediately’.

Thanks for this article, there are so many non-solutions posted out there for putting the machine to sleep. Coming from Windows with their very simple Windows + L hotkey it’s frustrating that Apple doesn’t do the same.
I set up now with ‘Command + Shift + L’ which is perfect.

Thank you very much. Such a relief. I was searching for a way to quickly lock my imac when i leave the desk and this simple solution fixed it. :) Cheers.

Robin.