Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.6: Lock the screen via a keyboard shortcut System 10.6
When I step away from my Mac at work, I want a quick way to lock the screen, and hitting a hot-corner with the mouse is problematic for me. This hint details how to lock the screen from the keyboard by using Automator to build a Service in Snow Leopard.

First, check the General tab on the Security System Preferences panel to ensure that the Require password [some period] after sleep or screen saver begins box is checked.

Then, open Automator in the Applications folder, and select Service from the screen that appears. At the top of the new Service's actions, in the Service receives drop-down, select no input from the options. Make sure that any application is selected in the second drop-down.

Add the Start Screensaver action (in the Utilities group of actions) to the Service by dragging it to the right. Save the Service (Automator does not ask you where to save it, just to name it). Next, open System Preferences and select the Keyboard preference pane. Select the Keyboard Shortcuts tab at the top, then the Services group on the left. The service you created should be near the bottom of the list of Services under the General disclosure triangle.

Double-click on the right side of the entry for the Service you created and assign a keyboard shortcut. This was a bit unintuitive, because the shortcut column is not distinctly visible, so it is not obvious that you can double-click in the assigned shortcut column to add a shortcut.

I had difficulty picking a keyboard shortcut that would work in 10.6.0. Command-L did not work for me, because it is assigned the Show All Preferences menu item in System Preferences. Control-L also did not work for me. Command-Shift-L did work once I reassigned the Search with Google Service a different shortcut.

Exit the keyboard preference pane to give it a try.

If you find yourself holding down the keyboard shortcut until the screen saver appears, and it disappears when you release the keys, you may want to decrease the time Snow Leopard waits before requiring a password in the Security system preference to immediately (or release the keys before the screen saver appears).

There are a number of helper apps, third party System Preferences panels, shell scripts, and even this previous hint that have promised a way to lock the screen with a keyboard shortcut in the past. This hint provides a simple method that does not require installing a third-party application or delving into shell scripting.
    •    
  • Currently 3.77 / 5
  You rated: 3 / 5 (22 votes cast)
 
[163,318 views]  

10.6: Lock the screen via a keyboard shortcut | 23 comments | Create New Account
Click here to return to the '10.6: Lock the screen via a keyboard shortcut' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Lock the screen via a keyboard shortcut
Authored by: ljharb on Sep 08, '09 08:49:39AM

It's not quite as fast as a keyboard shortcut, but if you open "Keychain Access" and check "Show Status in Menu Bar" in the preferences, a padlock will appear in the menu bar (it's icon reflects whether there are unlocked keychains or not).

The first item, "Lock Screen", should initiate the screensaver.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: petrafan on Oct 05, '09 12:59:50PM

not really. it just shuts the screen off.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: kitm on Sep 08, '09 09:57:52AM

I just hit Command Option eject to put my Mac to sleep.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: sherlokk2 on Sep 08, '09 10:00:45AM

Thanks for your hint but isn't there a built-in shortcut for locking the screen (Ctrl-Shift-Eject)?



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: Typhoon14 on Sep 08, '09 10:32:08AM

Now, I know that this has been the keyboard shortcut for instant display sleep for some time now, but I seem to remember that prior to OS 10.6, display sleep would never require a password, even if your system was set to require a password when waking from sleep (it have to go fully to sleep for the password requirement to be initiated). As of 10.6, display sleep does indeed seem to require a password, giving us a true screen-locking shortcut. Can anyone else confirm this change in behavior?



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: UberFu on Sep 08, '09 11:35:52AM

I can confirm that this works in Leopard as well - as did it in Tiger. BUt this is not a solution to merely activating a screensaver.

If I need to lock my computer for 5-10 minutes - walk away and come back so no one bothers my system while I step out - I don't want to have to wait 5 minutes just for the system to cycle downa dn crank back up.

The ability to hit a Keyboard Command natively on the Mac was around for years in Classic before the jump to OS X. And for some reason Apple moved it to a Menu only function with the OS change.

And if this Automator workflow works - it'll be great - 'cause I hate having to move the pointer to a "hot corner" all the damned time. Shouldn't have to.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: Typhoon14 on Sep 08, '09 06:14:51PM

This doesn't sound right. I've often used this command when the system was doing something hard drive and CPU intensive in the background, and it did not seem to do anything but turn off the display. Indeed, I usually did it if I was doing extensive video encoding that might take 8 hours or so. Even a minor reduction in processor clock speed would have extended the encoding time by a few hours, and I definitely would have noticed. More to the point, I don't really understand what you mean by the system cycling up and down. On all modern Macs the processor clock speed is adjusted dynamically depending on what the system is doing. Moreover, this adjustment happens instantaneously. It's not like some piece of industrial machinery that has to spin to its full operating speed slowly. I mean, the system can boot cold in about 30 seconds, wakes from full sleep almost instantly, and wakes from display sleep instantly. Nothing takes five minutes.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: UberFu on Sep 08, '09 11:40:08AM

Nope!

This Sleeps the Hard Drive and causes a several minute spin-down of the system.

Not the same thing.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: Typhoon14 on Sep 08, '09 10:46:01AM

If instead of activating the screen saver you want to lock the screen via the login window, the following will also work:

Create a workflow consisting of the "run shell script" block. Enter "/System/Library/CoreServices/Menu\ Extras/user.menu/Contents/Resources/CGSession -suspend" (without the quotes) as the script. Now simply save this and assign it a shortcut.

The effect will be more or less the same, but instead of activating your screen saver, it will take you to the main login window screen showing all user accounts (the same as selecting "Login Window" when using fast user switching). You will of course remain logged in.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: acalado on Sep 08, '09 06:49:53PM

I wrote up a step by step tutorial with screenshots that explains how to do exactly that. Figured I'd share it for those who need a bit more handholding:

Lock your Mac's screen like in Windows, Snow Leopard edition

[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: Typhoon14 on Sep 08, '09 10:56:52AM

I almost feel this should be turned into a more general hint. A lot of people probably haven't realized, but with the ability to create new services with Automator and the ability to assign them keyboard shortcuts, we essentially have a built-in shortcut manager along the lines of applications like Spark. In addition to its built-in and third-party templates, automator allows you to execute any applescript or shell script. Between the two, you can create an account-wide keyboard shortcut to do virtually anything.

One thing to note, whenever you invoke one these universal services via the keyboard, you are actually invoking it in the Services menu of the currently active application (you will see the application menu flash). I was concerned that this would not work in all Applications, however Services that require no input seem to work everywhere, even in Applications that do not support Services (e.g., Firefox). Cool!



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: willgonz on Sep 08, '09 01:14:16PM
I use LockTight http://www.gkoya.com/2006/11/23/locktight-for-mac-os-x-intel/
It is a System Preference Pane that you use to configure a hot key and then you can lock your screen via your keyboard shortcut.

[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: notmicro on Sep 08, '09 10:31:53PM

Good lord! Do yourself a favor and use the "Keychain in Menu Bar" hint, its trivial to configure and works great, despite requiring a mouse action and not a keyboard shortcut.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: Typhoon14 on Sep 08, '09 11:11:30PM

Except that the whole point here is that we want to use a keyboard shortcut. The method in the original topic takes about 30 seconds to setup, and requires no third-party applications or technical knowledge.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: q3 on Sep 09, '09 01:49:28AM

I can confirm that Ctrl-Shift-Eject does just that.
Maybe you have to activate the option 'Require password immediately after sleep or screensaver begins' in the Security PrefPane.

OK, it puts your monitor to sleep. But who cares if you're away from your computer anyway....

So why bother to create such a complicated solution?



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: pawnoir on Sep 22, '09 11:09:02PM
To lock my screen, 2 possibilities :
1.
- I use a script made in Automator, you can download it here : http://chriscook.me/featured-articles/new-mac-os-x-application-lock-desktop/
(its icon will appear on your desktop)
- Then, I have associated a keystroke to open this icon via AliasKeys, you can download it here : http://www.apple.com/downloads/macosx/system_disk_utilities/aliaskeys.html
--> This will immediatly launch the screen login session (it does not stop your app. running)
2.
- System pref., security, password when screen saver, and I activate the screen saver with a hot corner
--> This will immediatly launch the screen saver with my favorite pictures (in case I'd like to avoid the "rigid" blue screen session)
Hope it'll help, CU+

[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: burtonernie on Jan 26, '10 03:31:46AM

the original hint here using automator didn't work for me (OS 10.6.2). i tried several different key combinations and all resulted in that horribly annoying "boink" sound. did i do something wrong? is that sound just telling me that the keys i chose were already assigned? (i figured it would tell me so more clearly if that were the case).

regardless of all the comments, yes I DO want to start screen saver and not just lock the screen. i already know how to put the thing to sleep. but i have a very nice screensaver and i quite enjoy looking at it as i'm doing other things.

THANKS!!!



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: aiaiyaya on Apr 15, '10 07:37:15AM

I'm using os 10.6.2 and the automator tip works like a charm. Easy to setup, and I use the shortcut cmd-shift-s without any problems. Thanks a lot for the tip.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: dfrutos on May 30, '11 11:53:27AM

I agree with aiaiyaya, 10.6.7 works as original post. The only thing is the unintuitiveness of the double-click, if you watch other lines you will see where to do such a double click. I use Command+alt+L.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: jaykhimani on Dec 14, '10 11:43:43AM

To achieve quickly "lock screen" I activated "Show fast user switching menu" under System Preferences -> Accounts -> Login Options. So now whenever I want to lock the screen I just click the user switch menu on top right of the screen in menu and select Login Window... No need for defining key ring access or any other.



[ Reply to This | # ]
works fine
Authored by: Hawy.php on Sep 02, '11 09:56:55AM

the hint on the original topic works fine on Lion 10.7.1
i use ctrl-alt-L



[ Reply to This | # ]
How To Create Mac OS X Keyboard Shortcut to Lock Screen
Authored by: lukekowald on Nov 10, '11 10:00:39PM

Another easy way to lock your screen is listed at:

http://lukekowald.blogspot.com/2011/11/how-to-create-mac-os-x-keyboard.html

It also includes how to setup a quick Apple Magic Trackpad gesture to activate this.



[ Reply to This | # ]
10.6: Lock the screen via a keyboard shortcut
Authored by: robotthreads on Aug 28, '12 10:03:52AM

The following works on 10.7.4. Basically uses automator to create a utility to launch the screen saver app. I like it because it is much faster than using sleep. I used a couple of different how-to's to craft this including the one by Typhoon14 & acalado above.


1. Enable password for screen saver. To do this: Open System Preferences and click Security & Privacy. Check the "Require password after sleep or screen saver begins" box.
2. Copy Screen Saver application from "/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app" to your Applications folder.
3. Open Automator (in your Applications folder) and choose Service from the list of templates provided and click the Choose button.
4. In the left hand column under Library, select "Utilities".
5. In the second column, drag “Launch Application” to the right hand pane.
6. At the top of the right hand pane where you dragged the Run Shell Script action, click on the menu next to “Service receives” and choose “no input”.
7. From the File Menu select Save and choose a name for the utility.
8. From the System Preferences Pane Select "Keyboard"
9. Select the "Keyboard Shortcuts" tab on the top of the window
10. Select "Services" from left pane
11. Scroll down to "General" (you might have to expand the General selection) in the right pane and you should see the new utility you created.
12. Select the utility you created and add a keyboard shortcut for it.



[ Reply to This | # ]