How to Lock Your Mac Keyboard to Clean It
macOS has no dedicated “lock the keyboard” switch, so a quick wipe of the keys turns into a screen full of random characters and half-opened menus. This guide covers the built-in options that get you partway there, and the purpose-built way to freeze the keyboard and trackpad for a set number of minutes.
Why there's no obvious way to do this
macOS deliberately keeps the keyboard and trackpad live at all times — it has no Settings toggle and no defaults command to switch them off, because an operating system that let any app silently disable your input would be a security problem. That is the right call, but it leaves you with nothing built for the simple, common task of wiping down the keys.
Option 1: Lock the screen
The closest built-in trick is to lock the screen: press Control-Command-Q. macOS drops to the login window, so anything you type lands in the password field instead of your documents. It is better than nothing, but it was never meant for cleaning: the login screen is bright (useless for spotting dust), the trackpad still moves the pointer, and mashing keys enters a stream of wrong passwords — which can trigger a lockout delay or a Touch ID prompt in the middle of your wipe.
Option 2: Put the display to sleep
You can also put just the display to sleep — Control-Shift-Power on Macs with Touch ID, or Control-Shift-Eject on older keyboards. The screen goes dark, but the very first key or trackpad touch wakes it straight back up, so it does not actually hold through a cleaning.
Both are workarounds for a thing neither was designed to do. Neither one actually holds the keyboard and trackpad inert for a fixed stretch of time while giving you a dark surface to clean against.
The purpose-built way: freeze input on a timer
Mainspring has a Clean Mode that does exactly one thing: it locks the keyboard and the trackpad/mouse for a set number of seconds so you can wipe your Mac without turning it off.
- Open Mainspring from your menu bar and choose Clean keyboard, or open the main window and find the Clean Mode card under Power.
- The first time, macOS asks for Accessibility access — that permission is what lets an app intercept key presses and clicks. Click Open Accessibility Settings, switch Mainspring on, and try again. You only do this once.
- Pick how long you need: 30 seconds, 1 minute, or 3 minutes.
- The screen dims to near-black and every keypress, click, and trackpad swipe is ignored. Wipe away.
- Input comes back on its own when the timer ends — or hold Esc for about three seconds to finish early.
Because the overlay is near-black, it doubles as the best possible backdrop for spotting dust and fingerprints — the same trick photographers use to see smudges on glass.
Mainspring's Clean Mode freezes your keyboard and trackpad for 30 seconds, 1 minute, or 3 minutes, dims the screen so you can see the grime, and unlocks itself when the timer ends. No shutting down, no gibberish, no fuss.
Try Mainspring free →Signed & notarized by Apple · 1-day free trial · $29 once
Getting back in
There are three ways out, so you can never get stuck:
- Wait — the timer you chose runs down and input returns automatically.
- Hold Esc for about three seconds; a ring fills to confirm, then it unlocks. A stray tap of a cleaning cloth won't do it — you have to hold.
- Quit Mainspring — closing the app restores the keyboard and trackpad instantly.