How to disable the internal keyboard on a MacBook Pro?

My cat has a nasty habit of jumping over my MBP and causing keystrokes that mess up things (anywhere from stopping a playing video to deleting a file).

I'm looking for some utility or hack to disable completely the internal keyboard and to re-enable it either using the mouse or using some key combination.

Any ideas how to achieve this?


Karabiner-Elements is open source software with powerful keyboard customizations, including the ability to disable the internal keyboard when an external one is connected.

screenshot

I've got a 2018 MBP with the horrible keyboard which has started to fail in so many wonderful ways now. I have a cheapo bluetooth keyboard I just set right on top of the internal keyboard, and using Karabiner-Elements allows me to disable it so that the pressure from the keyboard above doesn't trigger unwanted key strokes.

https://github.com/pqrs-org/Karabiner-Elements


Just tried this on my 2013 MBP with 10.8.5:

The external keyboard still works fine, and I was able to disable, then reenable my internal keyboard.

To disable the internal keyboard of a portable Mac:

sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ The internal keyboard is then disabled, external keyboards will still work.

To re-enable the internal keyboard of a portable Mac:

sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/

When I initially disable the internal keyboard, terminal notifies me that:

(kernel) Can't unload kext com.apple.driver.AppleUSBTCKeyboard; classes have instances:
(kernel)     Kext com.apple.driver.AppleUSBTCKeyboard class AppleUSBTCKeyboard has 11 instances.
Failed to unload com.apple.driver.AppleUSBTCKeyboard - (libkern/kext) kext is in use or retained (cannot unload).

Nevertheless, the command works, no ill effects.

Thanks to: macrumours


There are a couple 3rd party programs that do similar things.. or just get a stand that will put your MBP at an angle so the cat doesn't jump on it..

Lockey

edit: you can also try Keyboard Cleaner


Mouse keys could actually solve your problem without any apps. It's a built-in OS X accessibility option (can be turned on and off). Basically, when you press the Option key 5 times, it's enabled (or disabled in the same way) and then you can only use like 6 to 8 keys on the keyboard to control the mouse - other keys and touchpad are disabled - so if your cat doesn't hit 1 or 2 keys (left and right mouse clicks), you are fine.

It is not 100% solution but could work in 80-90% cases. I am using it when I put my ergonomic keyboard on top of the MacBook Pro keyboard. Wonder when (and if) will ergonomic keyboards come to notebooks, to be honest. Soon, there will be world fulled with blind programmers with RSI or carpal tunnels in their wrists.

My actual version is El Capitan 10.11.1, but I think it worked on 10.10.5 which I had few weeks ago.