Blog

Stop Clicking Around: Faster Ways to Put Your Mac to Sleep

Three progressively faster methods to put your Mac to sleep, from terminal commands to the ultimate one-keystroke Hammerspoon solution.

I find myself constantly needing to put my Mac to sleep, and doing it the “normal” way is a pain. Grab the mouse, drag the cursor to the menu bar, click the Apple logo, then click Sleep. By the time you’re done, you could have made a coffee.

So over time, I went searching for alternatives, and I found a few. Here are three better methods, ranked from “good” to “why didn’t I know this sooner”. The third one is the fastest humanly achievable. Anything better would require putting your Mac to sleep telepathically, but unless you’ve trained with Master Yoda, that option isn’t available to you.

1. Running the Terminal Command

I used this method for a long time before discovering the others. It’s a decent alternative, less friction than the mouse-and-click dance. Typing feels faster, and I had already set up a way to quickly summon my terminal (which I still use for other things), so running the command was easy enough.

pmset sleepnow

Of course this method can be improved further by creating a shell alias so you don’t have to type the full command every time. But too much ceremony for something so simple.

2. Apple’s Built-in Magic

There are two variations here, both essentially enhanced versions of the previous method but using different paths:

Apple Shortcuts + Spotlight

First you need to have this Shortcut. It’s just one action that puts the system to sleep.

Then bring up Spotlight by pressing CMD + Space anywhere (this is the beauty of Spotlight, always one keystroke away). Type “sleep” and it will automatically highlight the first search result which most likely in your case as well will be the above mentioned Shortcut. Just hit Enter and your Mac drifts off into dreamland.

Using Siri

This one requires Siri to be enabled in System Settings. I’ve only used it with text input, but I’d expect voice to work too.

Go to System Settings → Siri → Keyboard shortcut and set your preferred trigger to quickly pop Siri anywhere.

My keyboard trigger is “Press either Command Key Twice”, and it’s even easier than pressing CMD + Space for Spotlight. Type “sleep” to Siri and it’s smart enough in this case to detect you have a “Sleep” Shortcut. Hit Enter, that’s it.

Pro tip: if “Sleep” clashes with something else on your system, rename the Shortcut to something unique so it always comes up first.

3. The Hammerspoon Way (BEST METHOD)

You can look it up online how to install and configure it or you can read my article on Hammerspoon where there is a short guide explaining how to do it and some other (very) productive use cases: One essential macOS app for productivity (it’s FREE).

Hammerspoon really feels like Harry Potter’s wand. It lets you create automations and shortcuts that simply aren’t possible out of the box. It’s real software magic.

I used the first two methods for a while and was genuinely satisfied. But then a thought crept in: this could be even faster. With Hammerspoon, I could skip Spotlight, skip Siri, skip everything — and put my Mac to sleep with a single keyboard shortcut.

So that’s exactly what I did. A small Lua script, triggered by a key combination, puts macOS to sleep instantly.

This is the script:

-- sleep.lua
local sleep = {}

-- Put the Mac to sleep
function sleep.goToSleep()
    hs.alert.show("Going to sleep...", 0.5)
    -- Small delay to show the alert before sleeping
    hs.timer.doAfter(0.3, function()
        hs.caffeinate.systemSleep()
    end)
end

-- Initialize with hotkey binding
function sleep.init()
    -- Bind Cmd+Shift+End to sleep
    hs.hotkey.bind({"cmd", "shift"}, "end", function()
        sleep.goToSleep()
    end)

    print("Sleep module initialized")
end

return sleep

In your init.lua file import it like so (assuming same root level, else tweak the require statement for correct path):

local sleep = require('sleep')
...
sleep.init()

Reload Hammerspoon Config from the menu bar and you’re done. Now I’m using CMD + SHIFT + END for it. One keystroke to sleep. Maximum efficiency achieved.

You know of other (better) methods?

P.S.: If you guys know where Master Yoda is, let me know, ok?