How do I lock the screen using a keyboard shortcut on OS X Mountain Lion with a Microsoft Natural Ergonomic Keyboard 4000?

Title says it all: how do I lock the screen using a keyboard shortcut on OS X Mountain Lion with a Microsoft Natural Ergonomic Keyboard 4000?


I stand corrected, trach a man to fish:

https://support.apple.com/en-us/HT201236


You do not need to use Third Party Apps to set a global short cut. You can use Automator Services,System Preferences keyboard Shortcuts and the CGSession -suspend command that switches to a login screen.

Use the Applescript :

do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend"

in a Automator 'Service' like this with the set up as no input and all applications.

enter image description here

Save it and then go to the Keyboard System Preferences. -> Keyboard Shortcuts tab. Select Services on the right. And scroll down to the bottom on the left to 'General'. There you will see your service. Click the addShortCut. And give the service a shortcut. Clost system prefs.

enter image description here

You may need to quit some apps and re open them first for them to pick up the short cut for the first time. You can see the ones that have already picked it up..

enter image description here

Now try the shortcut from the keyboard.


Or you can go to: Applications > Utilities > Keychain Access > Preferences > Show keychain status in menu bar.

This will put a lock in your menu bar and you can click Lock Screen to lock your screen. If you need a keyboard shortcut, you can add this in your keyboard under Settings.

Keychain Access menu

Also, here are steps to use a shortcut to put your computer in screen saver mode which locks your Mac at the same time.

  1. Open System Preferences.
  2. Select Security & Privacy.
  3. Select General.
  4. Be sure Require password [immediately] after sleep or screen saver begins is selected.
  5. Go to your applications folder.
  6. Open Automator.
  7. Select Services on the screen that appears.
  8. 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.
  9. Add the Start Screensaver action (in the Utilities group of actions) to the Service by dragging it to the right.
  10. Save the Service (Automator does not ask you where to save it, just to name it Logout for example).
  11. Next, open System Preferences again and select the Keyboard preference pane. Select the Shortcuts tab at the top, then the Services group on the left.
  12. The service you created should be near the bottom of the list of Services under the General disclosure triangle.
  13. Double-click on the right side of the entry for the Service you created and assign a keyboard shortcut.
  14. I chose Command-Shift-L for my shortcut.
  15. Exit the keyboard preference pane and give it a try.

You can always use Control+Shift+Eject (if you have a mac keyboard) or Control+Shift+Power on your mac to put your computer to sleep, but I don’t want that when I can just close the mba lid. We all know about hot corners, but I’m not a big fan of it as it always interferes with other options.

I had been using the lock menu icon for the longest time found in Applications > Utilities > Keychain Access > Preferences > Show keychain status in menu bar but it just takes too long sometimes to click that small icon when I’m in a rush since the target is so small.


UPDATE - 2021 answer is - ctrl-win-q

legacy below I used KeyRemap4Macbook to remap the pause/break key to eject. KeyRemap4Macbook is free, and it shows up in System Preferences after installing.

shift+ctrl+pause/break does the trick now.

screenshot from keyRemap4macbook

For newer versions of the OS (Sierras, El Cap) there is the new Karabiner-Elements with a slightly different interface:

screenshot from Karabiner-Elements

**Please note that KeyRemap4Macbook is now called Karabiner with the same functionality.

**update for Sierra - Karabiner ** new karabiner edit