Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On Windows I can hit Windows + L to lock my desktop. On Leopard there doesn't seem to be this capability. While I can set the screensaver to come on very quickly, I would like to hit a key combo to lock my computer.

share|improve this question

10 Answers 10

up vote 24 down vote accepted

You can create different methods to quickly lock your screen on OS X. There is a comprehensive article here: http://www.macworld.com/article/49080/2006/01/lockscreen.html

One simple way is to:

Open Keychain Access -> preferences -> tick Show Status in Menu Bar

When you click the little Lock icon in your status bar the first entry is Lock Screen. You should be able to bind a hotkey to this in System preferences -> Keyboard shortcuts.

share|improve this answer
1  
This is the best way I've found without using a third party app. –  dulaneyb Jul 23 '09 at 17:10
    
+1 this is how I do it - Keychain access icon on the menu –  robsoft Jul 23 '09 at 17:36
    
Good way to do it. –  GeneQ Jul 23 '09 at 17:44
    
Can you elaborate with some "for dummies" advice regarding setting the hotkey? I added an "application shortcut" where application is Keychain Access.app and menu title is "Lock Screen", but it won't work. –  Jonik Sep 26 '09 at 10:05
    
Very lousy that there is no native shortcut for this :-( –  Rabarberski Feb 6 '12 at 11:14

Control-shift-eject will blank the screen. If you wait until.. mmm.. sometime later this year... you may find that it also locks the screen...

share|improve this answer
    
You're saying it will (and already does) for sure or you hope it will? –  jtbandes Jul 23 '09 at 18:58
1  
I suspect he means that in Snow Leopard this feature is there. –  Matthew Schinckel Jul 28 '09 at 14:22
    
-1 Control-Shift-Eject doesn't do anything for me (Snow Leopard). –  hanleyp Sep 20 '09 at 23:40
    
In Leopard, this doesn't lock the screen. And it's a year later! –  Stefan Lasiewski Jun 17 '10 at 21:04
1  
This works perfectly in Snow Leopard, when “Require password immediately…” is set. –  Sidnicious Jun 30 '11 at 22:50

Snow Leopard provides a way to perform a Fast User Switching Lock Screen command from the keyboard using:

  • Automator to create a service that calls:

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

  • Create a system wide keyboard command which runs this service. I'm using Control-Option-Command-L.

This is all documented in this Art Of Geek article.

share|improve this answer
    
+1 This is a nice way of doing it; I just tried that it works. I hadn't used Automator before, but the article you link to explains it all very clearly. Also, if you really want to launch the screensaver instead of the user switching thing (as in the original question), check out this comment: artofgeek.com/2009/09/08/… –  Jonik Sep 26 '09 at 10:17
    
I finally went with hotkeys for two distinct actions: Lock Computer and Lock Computer & Sleep. (Read the comments on the article to see how to achieve the latter.) –  Jonik Sep 26 '09 at 10:32
    
I've been using this method since I posted this answer. It still works great. My only compliant is that it takes up to 10s to switch to the Login Window. –  hanleyp Sep 27 '09 at 16:08
    
Calling the command line from terminal takes about 8s, so 2s is the Automator activating and 8s is the actual CGSession call. –  hanleyp Sep 27 '09 at 16:09
    
It seems the Art of Geek website is gone? More details about the same solution in Fast User Switching/Apple Menu? –  Arjan Nov 6 '10 at 9:45

The easiest way, once it is set up, allows you to move the mouse to a corner of the screen, the screen saver activates immediately and requires a password to dismiss the screen saver.

  1. Set up a "Hot Corner" to activate the screen saver. This is in the "System Preferences", "Desktop & Screen Saver" pane. There is a button for "Hot Corners..." in the "Screen Saver" tab.

  2. Go to the "Security" preference pane. Make sure the checkbox for "Require password to wake this computer from sleep or screen saver." is checked.

share|improve this answer

Here is an easy implementation:

  1. Open the KeyChain access application
  2. Open its preferences from Keychain Access -> Preferences
  3. Select "Show keychain status in menu bar"

At this point all you have to do is click on the little keylock icon and select "Lock Screen", but here is something extra for more fun:

  1. Open Automator
  2. Create a New "Workflow"
  3. Click on the "Record" button
  4. Now record yourself selecting the keylock and then the "Lock Screen" option
  5. At this point your screen saver will kick in, so press ESC and log back in
  6. Stop the recording
  7. In the recorded steps, delete any recorded steps after "Lock Screen".

(It doesn't hurt to test it now by pressing the "Play" button)

  1. Now save your Workflow.
  2. Create a new Automator file (press Cmd + N)
  3. This time choose a new "Service"
  4. In the search on the left hand side look for "Run Workflow", then drag and drop it to the right hand side
  5. In the "Workflow" drop-down select "Other...", and locate the Workflow you saved above.
  6. Make sure at the top of this Service that you select "no input" for "Service receives"

(Test some more)

Now comes the real "magic"

  1. Now save your Service (give it a human-readable name like "Lock My Screen Service")
  2. Go to the "APple Menu" and open up "System Preferences"
  3. Select "Keyboard"
  4. In this section choose "Keyboard Shortcuts"
  5. Select "Services" on the left
  6. On the right hand side scroll all the way to the bottom under "General" and you will find "Lock My Screen Service"
  7. There is a grayed-out text to the right that says "none", which means that no shortcut has been assigned, so click on it and an "add shortcut" button appears. Click on it.
  8. Now press your desired combination (i.e. Ctrl + Alt + Cmd + L)
  9. Done. Close out and test it by pressing the button.

If you tested and followed this carefully, pressing the shortcut above will load the Service you created in Automator which in turn runs the workflow which moves the mouse to the Keychain menu and locks the screen for you.

share|improve this answer

Edit security settings to require a password to wake up from screen saver, throw this line into an apple script:

tell application id "com.apple.ScreenSaver.Engine" to launch

If you have quicksilver you can then setup a trigger to launch the applescript using whatever keystroke you like. Or you can add it as an application specific script ~/library/application support/"application name"/scripts and then use the built in MAC keyboard shortcuts to launch the script via that applications menu items.

share|improve this answer

Configure screen saver password and press Shift + control + eject

share|improve this answer

Fast user switching

Option 1: Enable the fast user switching menu in the Users & Groups preference pane, and select Login Window… from the menu.

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

Option 3: Many launchers and macro utilities also include a command for logging out to the fast user switching screen.

Locking the screen

Option 1: Enable the Keychain menu extra in the preferences of Keychain Access and select Lock Screen from the menu.

Option 2: Check Require password immediately after sleep or screen saver begins in the Security & Privacy preference pane. You can then lock the computer manually by pressing ⌃⇧⏏ to turn off the display or ⌥⌘⏏ to go to sleep.

share|improve this answer

Below is a tweak on Alejandrormz's Automator steps. This is in OSX Mavericks:

  • Find and open Automator
  • Create a new Service
  • From the 2nd column drag and drop "Start Screen Saver"
  • Select "Services receive no input" in drop down at the top
  • Save as e.g. "StartScreenSaver"
  • Find and open System Preferences
  • Open Keyboard/Shortcuts
  • Click Services on the left
  • Scroll to the botton and select "StartScreenSaver"
  • Click and assign a shortcut e.g. "CTRL+OPTION+CMD+L"

Optionally:

  • Find and open System Preferences
  • Open "Security & Privacy"/General
  • Set "Require password immediately after sleep or screen saver begins"
share|improve this answer

You can log off immediately by typing

⌘ ⇧ ⌥ Q

Your screensaver should kick in automatically after a while.

Update: The above is the easy Mac way. As usual, anything else Apple doesn't want you to do easily involves lots of pain.

You can almost hear Steve sneering, "Lock Screen with a keyboard is soooo Windows. Use a mouse people."

Jokes aside, Mark Wheadon has an extensive article documenting various methods. It turns out Apple really doesn't want you to use the keyboard to accomplish a Lock Screen...easily. Bad Apple. ;-)

share|improve this answer
1  
log off first don't sound similar to locking the desktop –  Joakim Elofsson Jul 23 '09 at 16:58
1  
But the question asked "is there a keystroke" to do it. The answer would be, no, not officially. But if you're willing to suffer then yes, there is a keystroke. In that case darren_n's method would be better. –  GeneQ Jul 23 '09 at 17:34
    
This logs you off, downvoted. –  HaggleLad Dec 24 '12 at 14:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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