I’ve been using my MacBook for almost three years now, and it still bugged me that I wasn’t able to lock the screen with just a keystroke. I’m sure there’s some other post out there describing how to do this, but I couldn’t find it, so I am creating one.

The method combines two posts I found, one that tells how to Lock the Mac Desktop from the Command Line, and one tells how to Create Your Own Keyboard Application Launcher via Automator.

First, open up Automator and create a new Service.
Automator Service

Next, drag in Run Shell Script, and set “Service receives” to “no input” in “any application.”
Automator Run Shell Script

Insert in this command, which will essentially lock the screen:

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

Then save the service. I saved mine as “Lock Screen”.

Now open System Preferences and click on Keyboard. Once there, go to Shortcuts and click Services in the left column. Scroll to the bottom of the right column, and you should see your service under General. Click to the far right, then add your shortcut by hitting it on your keyboard.
Keyboard Shortcuts

Once it’s set, test it out, be amazed.

Mac screen locked

Leave a Reply

Your email address will not be published. Required fields are marked *

+ thirty three = 40