52

Firstly, let me say that there's two questions on Think Different that claim to answer this question but do not:

  1. Does the MacBook Air have a Fast User Switching (Login Window) shortcut key? The answer to this question seems to "lock" the mac, but doesn't invoke the "Login Window..." command.
  2. Can I assign a keyboard shortcut to bring up the Mac OS X Login Window? The answer to this question provides a shortcut which initiates a log out, not a user fast switch.

So, is there a shortcut for this command?

thanks.

3

7 Answers 7

27

The short answer is no. OS X Lion doesn't have a way to assign a keyboard shortcut to Fast User Switching (which is going to the Login Window without logging off the current user).

There are, however, various alternatives to achieve that. You've pointed to different workarounds (I haven't tested those), I'll name a few more:

  • What I use: Launchbar. Simply invoke it, type "log.." and you already have the option to press enter to go to the login window, can't get much faster than that (you could assign a shortcut to that if you wish).

  • Although I haven't used it in a while, the "competitor" Alfred + Powerpack had something similar, the command was "lock" as far as I can remember.

  • BetterTouchTool: recommended by other users (I've seen this app in friend's Macs but never used it myself). It will also do what you want (shortcut to go to the Login Screen). It's been also recommended in the answers you linked. I add it here for reference and because someone mentioned it in the comments by @Steven Fischer

  • Using pure Scripting like the one used here. Note however, that most of the scripts that you will find, will make you write and hardcode the account's password, which is not a good idea. But if you check there, there's an alternative that doesn't do that. I haven't tested that myself, but if that script works, assigning it to a keyboard shortcut via Automator/Service ought to be a simple task. This Super User answer better explains the process (thanks @andy)

In any case, there's no built in method by default, but as you can see, with some digging and/or third party, you can do it. Using something like Launchbar or Alfred is a good idea for other reasons anyway ;)

4
  • 4
    Maybe this one is a better description for creating an Automator Service and assigning a keyboard shortcut.
    – iolsmit
    Commented Jan 26, 2012 at 23:47
  • @iolsmit yep, good catch. Commented Jan 26, 2012 at 23:56
  • +1 Awesome Martin thanks! Yes, I'm using a workaround myself via Alfred. But I just wanted to know if there was a shortcut or not without an app. Thanks so much for the answer!
    – andy
    Commented Jan 27, 2012 at 0:17
  • 1
    You can also set up a keyboard shortcut for going to the login screen via BetterTouchTool. Commented Jan 27, 2012 at 0:50
27

Control+Shift+Eject

or

Control+Shift+power-button

The latter doesn't seem to work in Mac OS X 10.11(.6), but the former still works.

To guarantee that the login window is shown immediately after entering one of the above shortcuts, make sure to change the relevant security setting to require a password (i.e. require logging-in) immediately "after sleep or screen saver begins":

  1. Enter +space to open Spotlight search.
  2. Type "security" and hit Enter when "security & Privacy" is suggested; the "Security & Privacy" settings should be shown.
  3. Ensure you're on the "General" page.
  4. Change the "Require password ..." setting to "immediately".

Source for info about the password security setting:

8
  • 7
    Control + Shift + Eject immediately sleeps the display on OS X 10.9; is this the behaviour you see? Commented Feb 1, 2014 at 13:15
  • 3
    The only correct and simple answer. Strange nobody voted for this.
    – magikMaker
    Commented May 9, 2014 at 9:29
  • 3
    Thank you. This is essentially all I needed. Sleeps the computer and requires a password when awoken. The password part being the important bit. Commented Aug 11, 2014 at 19:36
  • 2
    Locked screen (screen saver, but with the displays immediately sleeping) is not the same as Login Window. Cool trick, but already addressed by the OP as not the solution they're looking for in their referenced “1. Does the MacBook Air have a Fast User Switching (Login Window) shortcut key?” Commented Apr 25, 2016 at 1:33
  • In combination with Ask for password immediately for in 5 seconds, this result to Lock computer, which is most desired commonly. Commented Mar 21, 2018 at 17:17
10

If you have the Alfred Powerpack, you could assign a shortcut to the Lock command (which logs out to the fast user switching screen):

Another option would be to save a shell script like this to ~/Library/Scripts/ and assign it a shortcut using FastScripts:

#!/bin/sh

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
1
  • This is wrong. The question was about showing the login window not the lock screen. Commented Oct 18, 2023 at 9:33
8

There is a fairly convenient, fully native way to do it, with only a small amount of setup. It's not a single keyboard shortcut, but it is a keyboard shortcut.

Summary:

Put fast user switching into the menu bar, then enable a keyboard shortcut to focus it.

Steps:

  1. Go to the Users & Groups pane in System Preferences, then to the Login Options section. Choose to show the fast user switching menu (in any form).

  2. Cmd-drag that new menu item as far left as possible. (This makes it the first to be selected by the keyboard shortcut, but really it can be placed anywhere.)

  3. Go to the Keyboard pane in System Preferences, then to the Keyboard Shortcuts tab. Continue to the Keyboard & Text Input category, and choose a shortcut for the "Move focus to status menus" item.

Result:

If you followed step 2, then pressing your keyboard shortcut will focus the fast user switching menu. You open the menu by pressing the down arrow, then select a choice with either enter or space.

This shortcut lets you directly select a user, so you can choose to bypass the login window or select it from the menu.

I would recommend a shortcut of control + fn + enter, as this puts your fingers on the return key, and hence just above the arrow keys. Plus, I don't know of any other shortcuts it would collide with.

1
  • This should be the accepted answer b/c some people don't want the computer to go to sleep and others may not want to install software that does a million things just to do this done simple thing. Commented Dec 7, 2015 at 18:50
1

There is a sleep command i Guess so. it's ctrl + shift + eject key. But you have to make sure in "Prefernces>Security & privacy> Reuiquire Password" is checked if you want password after sleep

1
  • This is wrong. The question was about showing the login window not the lock screen. Commented Oct 18, 2023 at 9:33
0

Not at all a need to go through so many workarounds when simply the following key combination (as rightly mentioned by @daniel answered Feb 1st, 2014) does the needful:

Ctrl + Shift + Eject

However, for some unknown reason, the same didn't work on my friend's Mac Mini. Even then, the following worked smoothly:

  • System Preferences
  • Security & Privacy
  • General
  • Require Password immediately after sleep or screen saver begins

After this, either:

Enable Screensaver after some time

or, just like I did:

Set "Start Screen Saver" as one of the screen "Hot Corners"

Now I simply use a Hot Corner before leaving my desk to lock the system.


PS: I guess, @daniel's answer should be marked/ticked as the correct one, as the current answer seems kinda redundant since new, relevant options negate the need for external tools. #JustSaying ;)

1
  • This is wrong. The question was about showing the login window not the lock screen. Commented Oct 18, 2023 at 9:33
0

The answer is YES (at least in recent versions of macOS). Use SkyLight private function. You can then assign a keyboard shortcut to it using productivity apps of your choice.(like karabiner &c.)

#include <stdio.h>
int SLSCreateLoginSession(int *outSession); //courtesy of NUIKit/CGSInternal

int main(){
    int outsession;
    int ret = SLSCreateLoginSession(&outsession); 
    printf("login session created: %d\n",outsession);
    return ret;
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .