Introduction
One of the nicest things about using an MBP is being able to just close the lid and leave, then open it and get right back to work. But what about when you’re using an external monitor? I personally prefer hitting a keyboard shortcut to turn off the screen and walk away, then just pressing any key when I need it again. Thanks to macOS’s excellent sleep management, it wakes up almost instantly and I can jump straight back into work mode. Sure, there’s a Sleep button you can click, but how is that more convenient than a shortcut? Reference 1 links to a Zhihu discussion on this exact issue, and honestly, even with hundreds of answers, there still wasn’t a truly practical solution.
Below are the four methods I’ve summarized for putting your Mac to sleep with a keyboard shortcut.
Tutorial
Method 1 - Use the built-in system lock shortcut
First, macOS provides a built-in shortcut for locking the screen: ctrl+comd+Q

It’s similar to Win + L on Windows. After pressing it, the screen locks immediately, and a few seconds later the Mac goes to sleep automatically. However, since this shortcut is provided by the system, it can’t be customized. Also, the screen doesn’t go black right away after locking — there’s a few-second period where it stays lit. Personally, I’m not used to that approach. And honestly, if Apple gives us a shortcut for Lock Screen, why not provide one for Sleep in the same menu?
Method 2 - Use a special keyboard
If you’re using a Magic Keyboard or an older MBP, you may find the circled 3 key on the keyboard (the eject key). As shown in the image, you can use the shortcut ctrl+comd+eject to put the Mac to sleep. In reality, though, not all keyboards have this key, so this only works if your hardware supports it. Still, it’s pretty convenient.

Method 3 - Use third-party software
You can also achieve this with third-party software. A more complicated option is the BAB app mentioned in Reference 2. Its keyboard module lets you configure one-key sleep, but the software is so powerful that it can do far more than just sleep — it can trigger all kinds of system actions. That also makes it very easy to conflict with other software, so after using it for a while, I gave it up because I couldn’t tolerate the side effects from those conflicts. 
A simpler option is an app called QuickSleep (the download link from PC6 is provided in Reference 3). The whole app does just one thing: lock the screen. You can assign any shortcut you want, and it’s very straightforward.

Method 4 - Use Automator (recommended)
I used to love tinkering and downloading all kinds of software, but after overdoing it, my system would constantly run into weird issues. Later I realized the problem was software conflicts. These days, if I can achieve something without third-party tools, I’ll avoid them whenever possible. Automator is a built-in macOS tool for running scripts, so there’s nothing to download. The idea is simple: since macOS can run shell scripts, we can use Automator to execute a sleep script we write ourselves. It’s incredibly simple — just one line of code. Here are the steps:
-
Search for Automator in Spotlight and open it.

-
In the popup window, choose Quick Action and click Choose.

-
In the next window, follow the image and select Utilities → Run Shell Script. Make sure the Workflow receives option marked as 3 is set to no input, then enter the following code in the area marked as 4 and click Save (if you just close the window, it will prompt you to save).

pmset sleepnow
-
Open System Preferences → Keyboard Shortcuts → Services, then find the script you just named (it’s usually under General, and it’s definitely there — just look carefully).

-
Once you find it, assign a shortcut that doesn’t conflict with any system shortcut, and you’re done.

Give it a try — it works really well, and you don’t need any third-party tools. I personally got used to using ctrl+commd+L to turn off the screen. What about you?
References
- Zhihu - How can I lock the screen in macOS with a keyboard shortcut?
- BAB Official Website
- PC6 - QuickSleep Download
All articles in this blog, unless otherwise stated, are licensed under @Oreoft . Please indicate the source when reprinting!