Lock Your Mac In A Keystroke (Without Putting It To Sleep)

We’ve shown you one way to lock your Mac with a keyboard shortcut, but if you’d like to do so without putting your computer to sleep, reader Scott shows us an alternative method.If you have BitTorrent downloads or other sleep-vulnerable processes running, this method of locking your computer is probably preferable to putting it to sleep. Just open up Automator and pick “Service” when it starts up. At the top of the workflow, where it says “Service receives selected text”, change the “text” dropdown to “no input”. Then drag the Run Shell Script action into the workflow, replacing cat in the text box with:

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

Once you’ve done that, your workflow should look like the image above.

Save the service as “Lock Screen” (or whatever you want), then open up System Preferences > Keyboard > Keyboard Shortcuts. If you click on Services in the leftmost pane and scroll down to the bottom, you’ll find your new service in the list and you can assign it whatever keyboard shortcut you want. Now, when you hit that shortcut, your Mac will head into Fast User Switching mode, keeping all your programs running as normal (but requiring a password to access them again. Thanks Scott!

The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.


2 responses to “Lock Your Mac In A Keystroke (Without Putting It To Sleep)”

Leave a Reply