How to Lock Your Mac Keyboard for Cleaning
Wipe your keyboard without typing gibberish, launching apps or deleting files. How to lock a Mac keyboard for a set time with Raycast, plus Apple's own advice for cleaning it safely.
Wipe your keyboard without typing gibberish, launching apps or deleting files. How to lock a Mac keyboard for a set time with Raycast, plus Apple's own advice for cleaning it safely.
You grab a cloth to wipe the crumbs off your keyboard, and three seconds later you've renamed a file, sent a half-written message and opened Siri. Your Mac keeps listening while you clean.
The short answer: install the free Clean Keyboard extension for Raycast, run Lock Keyboard and pick how long, from 15 seconds to forever. Every key press is ignored while you clean, and ⌃ U unlocks it early. If you're doing a deep clean with a damp cloth, follow Apple's advice instead: shut down your Mac and unplug it first.
| Method | Screen stays usable | Unlock | Best for |
|---|---|---|---|
| Clean Keyboard for Raycast | Yes | Timer or ⌃ U | A quick wipe |
| Lock Screen | No | Your password | Keys go to the login field |
| Shut down | No | Turn it back on | A deep clean |
Clean Keyboard is a free, open-source extension with more than 85,000 installs. It does one thing: it blocks your keyboard for as long as you choose.
⌃ U to unlock it sooner.
A few things worth knowing:
fn key, media keys like volume and play, and the Touch ID button itself, so they still work. On macOS Tahoe and later, turn on Lock Function Row Keys in the preferences to block the function row as well.⌃ U, or tap either ⌘ key three times, to unlock with your fingerprint. In a pinch, holding both ⌘ keys for eight seconds forces the lock off.@clean-keyboard and ask it to lock your keyboard for 30 seconds.Clean Keyboard works on Windows too, where it locks the keyboard the same way.
macOS has no keyboard lock, but locking the screen comes close. Press ⌃ ⌘ Q, or choose Apple menu → Lock Screen.
With the screen locked, whatever you press lands in the password field instead of your open apps, so your documents are safe. It's not perfect: you might trigger a few failed password attempts, the volume and brightness keys still work, and you have to sign back in afterwards.
For anything more than a dry wipe, Apple's guidance is to turn off your Mac and unplug it before cleaning. Then:
For crumbs under the keys, hold your MacBook at an angle and gently use compressed air.
Here's a quick tour of what else it can do, in under seven minutes:
Not with macOS alone. A tool like Raycast's free Clean Keyboard extension blocks key presses for a set time while the screen stays on and unlocked. Press ⌃ U to end it early.
Mostly. With the screen locked, keys go to the password field instead of your apps, so nothing gets typed into your documents. You may still trigger failed password attempts, and media keys like volume still work.
macOS handles some keys itself, so the fn key, media keys like volume and play, and the Touch ID button aren't blocked by Clean Keyboard. On macOS Tahoe and later, turn on Lock Function Row Keys to block the function row too.
Apple recommends a soft, lint-free cloth, slightly damp with water if needed. You can also use a 70 percent isopropyl alcohol wipe on the keys. Don't spray liquid directly on the keyboard, and avoid bleach and abrasive cleaners.
Clean Keyboard has a Lock Mouse Clicks option that blocks clicks and dragging while you clean. It needs Touch ID, which you use to unlock. Scrolling and pointer movement still work.
More guides
Turn Caps Lock into a Hyper Key on Mac and get a whole layer of shortcuts that never clash with your apps. How to do it with Raycast in a minute, or with Karabiner-Elements.
Switch your Mac between light and dark mode with one keystroke. macOS has no shortcut for it by default, so here's how to set one up with Raycast or the Shortcuts app.
Connect your AirPods, headphones, keyboard or mouse without digging through menus. Three ways to do it on a Mac: Control Center, System Settings, and the free Toothpick extension for Raycast.
Unplugging your MacBook from a dock full of drives? Eject every external disk and disk image in one step with Raycast, or with Finder, Terminal and a one-line AppleScript.
