How to lock your Mac keyboard and trackpad for cleaning

macOS can't lock the keyboard by itself: Lock Screen and Sleep still take keystrokes. To really lock it, shut down, or use a cleaning app that blocks every key and click until you unlock it.

The quickest way: Cleaning Mode

  1. Install Cleaning Mode and allow Accessibility when it asks.
  2. Click the keyboard icon in the menu bar and choose Start Cleaning Mode.
  3. Clean. Every key, click, scroll and gesture is ignored, on the built-in keyboard and trackpad and on anything connected.
  4. Type “open” to unlock.

If you ever need out without typing, close the lid. Your Mac goes to sleep, and Cleaning Mode turns itself off whenever your Mac sleeps or locks, so you can't get stuck.

Without an app: shut down

Choose Apple menu > Shut Down and wait for the screen to go dark. This is what Apple recommends before cleaning, especially with any liquid. On many MacBooks, pressing a key turns it back on, so it may start up while you wipe.

Why Lock Screen doesn't work

Lock Screen (Control-Command-Q) only hides your desktop. The keyboard keeps working: wiping it types into the password field, media and brightness keys still respond, and enough wrong attempts can make your Mac wait before letting you try again.

Why Sleep doesn't work

A sleeping Mac wakes up on any key press or click, so the first wipe wakes it.

External keyboards and mice

A Magic Keyboard, Magic Mouse or Magic Trackpad can be switched off with its power switch. Cleaning Mode also blocks them, so you don't have to switch each one off.

Questions

Is there a keyboard shortcut to lock the keyboard on a Mac?

No. Control-Command-Q locks the screen, but the keyboard still types into the password field. You need to shut down or use an app like Cleaning Mode.

How do I unlock the keyboard after cleaning?

With Cleaning Mode, type the word “open” on the keyboard. Closing the lid of a MacBook also turns it off.

Can I lock only the trackpad?

Cleaning Mode locks the keyboard, trackpad and mouse together, so you can clean all of them in one go.