MainspringGuides › Lock keyboard to clean
macOS Guide

How to Lock Your Mac Keyboard to Clean It

Updated July 2026 · 3 min read

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.

  1. Open Mainspring from your menu bar and choose Clean keyboard, or open the main window and find the Clean Mode card under Power.
  2. 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.
  3. Pick how long you need: 30 seconds, 1 minute, or 3 minutes.
  4. The screen dims to near-black and every keypress, click, and trackpad swipe is ignored. Wipe away.
  5. 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.

Lock it properly, in one click

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: