How to lock your Mac keyboard to clean it
Wipe the keyboard without opening twenty windows and typing a paragraph of nonsense.
macOS has no keyboard lock: the usual advice is to shut the Mac down before you clean it. MacFixes locks the keyboard for a set time (60 seconds by default) so you can clean it with the Mac still on, then unlocks on its own.
Part of MacFixes: 7 days free, then $2.99 a month or $17.99 once, with every app and fix included.
What macOS gives you
The usual advice is to shut the Mac down first, or to log out. There’s no built-in way to ignore the keyboard for a minute while it’s running.
How MacFixes fixes it
- 1Turn on the fixOpen MacFixes Settings → Keyboard and turn on “Cleaning mode” (or type its name into Search for a fix).
- 2Allow AccessibilitymacOS asks for Accessibility permission so MacFixes can ignore key presses.
- 3Start itThe keyboard is locked and the screen dims or goes black, whichever you chose. It unlocks by itself when the time is up, or when you click Done.
Why wiping a keyboard types things
A cloth dragged across a keyboard is, to the Mac, a long string of key presses. Every one goes to the app in front. In a document it types a line of nonsense; in Finder it jumps the selection around, and Return starts renaming whatever is selected; with ⌘ or ⌃ caught under the cloth it becomes shortcuts — ⌘Q quits the app, ⌘W closes a window, ⌘Delete moves a selected file to the Trash.
Nothing in macOS tells it to ignore the keyboard for a while. Accessibility settings can slow keys down for people who need that, and you can switch an external keyboard off, but there’s no switch that says “don’t listen to the keys for the next minute” on a running Mac.
The ways people clean a Mac keyboard today
Shut the Mac down. This is what Apple’s own cleaning advice starts with: turn the Mac off and unplug it before you clean it. It’s the safest way and the only one that also stops a damp cloth reaching anything live. It’s also the slowest, because every app and window has to come back afterwards.
Lock the screen. Press ⌃⌘Q, or choose Lock Screen from the Apple menu. Your apps no longer see the keys, so nothing gets typed into a document and no shortcut fires. The keys still go somewhere, though: into the password field, which you then clear before you log back in.
Let the display sleep. Pressing a key wakes it, so this lasts exactly as long as it takes to touch the first key.
Switch off or unplug an external keyboard. A wired keyboard can be unplugged and many Bluetooth keyboards have a power switch. That covers the external one only — a MacBook’s built-in keyboard stays live.
Lock the keyboard for a set time. This is what Cleaning mode in MacFixes does: the keyboard is locked until the time runs out or you click Done, and the Mac and your apps carry on as they were.
Cleaning the keyboard once it’s locked
Locking the keys deals with what the Mac does while you wipe. What you wipe with matters as much. Apple’s guidance for its products is to use a soft, lint-free cloth, slightly damp — never wet — and never to spray anything straight onto the keyboard, so no liquid gets into the gaps around the keys. For disinfecting, it allows 70% isopropyl alcohol wipes, 75% ethyl alcohol wipes or Clorox Disinfecting Wipes on the hard surfaces, and says to avoid bleach and hydrogen peroxide. Wipe gently; scrubbing hard can wear the coating on the keys.
Crumbs under the keys. Compressed air does more than a cloth here. Apple’s advice for the MacBook butterfly keyboards is to hold the Mac at about a 75-degree angle, so it’s nearly upright, and spray the keys from side to side, then turn it onto each side and do the same. Keep the straw on the can a short distance from the keys and use short bursts.
The screen. If you chose for the screen to go black, dust, fingerprints and smudges on the glass show up clearly against it, so it’s the moment to wipe the display too — with a dry or barely damp cloth, the same way.
The power button. On MacBooks with Touch ID it is the top-right key of the keyboard. Pressing it can put the Mac to sleep, and holding it down forces the Mac to shut down, so wipe that one lightly whatever you use to lock the keys.
The trackpad or mouse is easiest last. You click Done with the pointer to finish early, so keep it to hand until the keyboard is clean.
How Cleaning mode works
Turn on Cleaning mode in MacFixes Settings and allow Accessibility when macOS asks; that is the permission that lets MacFixes ignore key presses. The fix also gets its own card in the menu bar panel, so you can start it from there when you pick up the cloth.
Once it starts, the keyboard is locked and the screen dims or goes black, your choice. It unlocks by itself after a set time — 60 seconds by default — or straight away when you click Done. You don’t need to find a key combination to get out, which matters when the keyboard is locked.
Cleaning mode is part of MacFixes Pro.
If the keyboard still misbehaves after cleaning
Dirt under a key is a common reason a key sticks or one press comes out as two. If letters still double after a clean, the key may be worn rather than dirty: filter out double letters explains how to tell the two apart, and what a filter can and can’t fix.
Sharing your screen is the other moment a desk needs tidying, and there it’s the desktop rather than the keyboard: hide the desktop icons before the call and bring them back after. And if you want the Mac to stay on while you’re away from it rather than locked, keep it awake for that time.
Permissions, and turning it off
“Cleaning mode” needs macOS’s Accessibility permission. macOS asks you, and you allow it once.
- Accessibility lets an app see and work the windows, menus and buttons of other apps, and click or type for you. You can see it, and take it back, in System Settings → Privacy & Security → Accessibility.
To stop using it, open MacFixes Settings → Everyday and use the switch on the “Cleaning mode” row.
Questions
How do I lock my Mac keyboard while cleaning it?
macOS has no keyboard lock. Shutting the Mac down is Apple’s advice; locking the screen with ⌃⌘Q stops your apps seeing the keys, though they still type into the password field. MacFixes’ Cleaning mode ignores the keyboard for a set time and unlocks on its own.
How do I get out early?
Click Done on the screen. Otherwise it unlocks by itself when the time is up — 60 seconds by default.
Do I need to turn my Mac off to clean the keyboard?
It’s what Apple recommends, and it’s the safest choice if you use anything damp. To wipe the keys with the Mac still running, lock the keyboard first so nothing gets typed.
What can I clean a Mac keyboard with?
A soft, lint-free cloth, slightly damp at most. Apple allows 70% isopropyl alcohol wipes, 75% ethyl alcohol wipes or Clorox Disinfecting Wipes on hard surfaces, and says not to use bleach or hydrogen peroxide or to spray anything directly onto the keyboard.
Why does the screen go black?
You choose dim or black. Against a black screen, dust and smudges on the display are easy to see, so you can wipe it at the same time.
What does it cost?
Cleaning mode comes with MacFixes: 7 days free, then $2.99 a month or $17.99 once.
More fixes macOS doesn’t give you
One of 47 fixes and 10 apps in MacFixes. Every fix · Every app · Something else your Mac won’t do? Request it.
Lock your Mac keyboard to clean it with MacFixes
MacFixes has 47 fixes for things macOS gets wrong or leaves out. Add only the ones you want. Free for 7 days, then $2.99 a month or $17.99 once. macOS 14 Sonoma or later.