Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

OSX machines have a keyboard shortcut to put the machine to sleep, which suspends processing, downloads, and other operations.

OSX machines also have a Lock function which can be triggered via a menu option. It can also be triggered by running a specific command: /System/Library/CoreServices/"Menu Extras"/ -suspend

How can I lock my OSX machine with a keyboard shortcut?

share|improve this question
I have previously set up an Automator "service" to run the above command in a bash script triggered by a specific shortcut, but that no longer seems to work. Choosing the Service from the (Application) menu does nothing. Issuing the command directly works. – Eric Jul 15 '13 at 13:43

The default is:


Note: If you have a newer mac without a disc drive, replace Eject with the Power button.

The screen locks and turns off, but the computer is still running.

share|improve this answer
I believed that the shortcut you posted caused the machine to sleep, but that doesn't seem to be the case--processing does seem to continue in the background. – Eric Jul 15 '13 at 14:53
Yeah, it puts the display to sleep and locks it (assuming you have that option set up). – nerdwaller Jul 15 '13 at 14:57

You can assign a shortcut to CGSession -suspend with an application like Alfred or FastScripts.

If you have the Alfred Powerpack, you can assign a shortcut for the lock action:

Or you can use control-shift-eject (or control-shift-power) if you enable this setting from the Security & Privacy preference pane:

share|improve this answer

Your Answer


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.