Can I assign a keyboard shortcut to bring up the Mac OS X Login Window?

I’d like to assign an “Every Application” keyboard shortcut to bring up the login window, for when I step away from my computer. Is there a way to do this? (Lion-only methods are fine.)


I realise that this thread is probably quite old by now, but for all the options that has been given here, the simplest way has not been discussed.

Apple allows you to lock your screen with a keyboard shortcut. You don't have to create one, there is one built right in to OSX — via the “Require password after sleep or screensaver” feature.

Here is how to use it:

  1. Make sure that you have “Require password after sleep or screensaver begins” set to “immediately”.

To do this, follow these steps:

  1. Open System Preferences
  2. Click on Security (on Lion, “Security & Privacy”)
  3. Go to the General tab
  4. If you don't already have one, put a tick in the box next to "Require password after sleep or screen saver begins"
  5. Set the time interval to “immediately”
  6. Exit System Preferences

When now when you want to lock your Mac, simply use the keyboard shortcut

Ctrl ⌃ + Shift ⇧ + Eject ⏏ or Ctrl ⌃ + Shift ⇧ + Power


If you want to assign alt ⌥+cmd ⌘+L to lock screen without installing any programs, in 5 minutes, I suggest you doing these three steps:

  1. Create a Service in Automator and set "Service receives selected" to "no input" instead of "text".

  2. (Still in Automator) add 'Run AppleScript' (search on the left "apple" then double-click).
    In the script in place of (* Your script goes here *) you copy-paste:

    do shell script "'/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession' -suspend"
    Save and exit. (You can name your service "Lock Screen".)

  3. Open System Preferences, Keyboard then in Keyboard Shortcuts tab and under Services you will find your service "Lock Screen" towards the bottom of the list.
    Now, click on "none" next to "Lock Screen" to assign ⌥⌘ L to your service. Actually I suggest rather ⌃⌥⌘ L because ⌥⌘ L is assigned in Finder.

Done.

(For step 2 cudos goes to Lauri Ranta!)


Press Shift-Cmd+Q. Make sure that "Reopen windows when logging back in" is checked. Press enter.

Thanks to Lion, when you log back in, everything will look the same.