In macOS Mojave, I found that you could make an Automator app that allowed fast user switching by a hot key. The command run was

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID `id -u XXXXXX`

With the Automator App, I could assign a hot key which would then run the command easily without any mouse interaction.

I'm now setting up a Big Sur computer and trying switch to a different user by a hot key. The script above does not work now and gives a no such file error. I'm wondering if there is another way to switch to a userid or a different command to use in order to do this?


User.menu along with other menu items were incorporated into Control Center in Big Sur, which removed the menu item package from Menu Extras. Gone with it is CGSession.

There does not appear to be an immediate replacement, and while workarounds for some of its other functionality have been developed, nothing for fast user switching yet.

  • Thank you for the information and that's too bad. I did find a work around for this, which works pretty well. I am using a MacBook Pro M1 so with a Touch Bar. If you touch the touchID for 1/2 sec or so it will ask you to switch users by clicking. So now can switch back and forth pretty easily by using the correct fingerprint for that user. – You Me Dec 28 '20 at 21:05

In Big Sur, you can set up a keyboard shortcut to switch users as follows.

  1. Go to System Preferences > Dock & Menu Bar > Fast User Switching
  2. Enable Show in Menu Bar
  3. Go to System Preferences > Security & Privacy > Privacy > Accessibility
  4. Add Automator and System Preferences to the list of apps allowed to control your computer
  5. Automator > File > New > Quick Action
  6. Add a Run AppleScript Action
  7. Enter the AppleScript below
  8. Save as Login Window
  9. Go to System Preferences > Keyboard > Shortcuts > Services > General
  10. Assign a keyboard shortcut to Login Window
tell application "System Events"
    tell its application process "ControlCenter"
        tell its menu bar 1
            click its menu bar item "User"
        end tell
        tell its window "Control Center"
            tell its group 1
                set btns to its buttons
                repeat with btn in btns
                    if name of btn = "Login Window..." then
                        click btn
                    end if
                end repeat
            end tell
        end tell
    end tell
end tell

The following AppleScript invokes Fast User Switching in Big Sur, assuming you enable Show in Menu Bar.

  • Can the script be modified to select a certain user? So if you had User1, User2, etc... Tell the script to go directly to User2 rather than to the Login Window? – You Me Mar 18 at 22:04

You must log in to answer this question.

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