Hardware needs to be kept clean. You can let your laptop or a MacBook get fairly grimy before it starts to actually have an effect on how it runs e.g., letting dust and such build up inside it, but you should keep it as clean as you can. This obviously means cleaning spilled items even if it’s just a drop or two as soon as you can. On principle, you should shut a MacBook down when you’re cleaning it but if you need to clean it while it’s on, you may want to disable the keyboard to avoid accidental key presses.

Note: You can also just lock a MacBook and clean the keyboard. Any keys that are pressed won’t actually do anything since the lock screen will block them.

Disable the keyboard on macOS

If you’re not willing to shut down your MacBook or lock it for cleaning, or you’re just really interested in a way to disable the keyboard on macOS, there are two free apps that you can use.

The first is KeyboardCleanTool. The tools has been developed by the same person who made BetterTouchTool and it’s built for cleaning the keyboard. When the app is run, it will disable the keyboard but still allow you to use the trackpad or a mouse. Once you’re done cleaning it, click the app’s button and it will enable the keyboard.

The second app that works almost the same way, and is also free, is called KeyboardLocker. You can download it from the Mac App Store. The app disables everything from the keyboard to the trackpad the second it is launched. In order to enable the keyboard again, you have to tap the Command+Q keyboard shortcut.

It goes without saying that if you happen to have a pet that likes to step on your keyboard, or even sit on it, these apps might also be of some use to you. In fact, they’re probably more useful in that scenario since you can always turn your MacBook off or lock it for a little wipe down.

If you decide to use these apps to clean the keyboard, make sure you don’t have anything that will steal focus away from them. You might not be able to quit them if that were to happen. Scheduled actions can still be executed on the Mac even if keyboard input is disabled e.g., you can enable a timed screenshot and it will still be captured so be careful nothing sends them to the background. Neither of these apps are set to run at startup, nor do they have the option to be able to, and for good reason. Don’t try and force them to either.

Read How to disable the keyboard on macOS for cleaning by Fatima Wahab on AddictiveTips - Tech tips to make you smarter