30

Is it possible to completely disable the built-in keyboard on a MacBook? No input should be possible from that keyboard when I connect an external keyboard. This is sort of possible with the trackpad and the mouse, is there an option (or indeed a hack!) to do the same with the built-in hardware?

  • How about some of the solutions suggested in this similar superuser question? – binarybob Oct 14 '12 at 18:40
  • 1
    I started down the path of turning this into an applescript that would automatically toggle the internal keyboard on and off: sudo kextfind /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ 2> /tmp/keyboard-kext-out; if [ -s /tmp/keyboard-kext-out ]; then; echo "Kext is NOT loaded"; else; echo "Kext is loaded"; fi But I couldn't quite get it to work. Here's hoping that someone else with more motivation that me can pull that off. – timmfin Feb 6 '13 at 18:19
34

From Googling around, I found this page. It suggests that you unload a AppleUSBTCKeyboard.kext to disable keyboard:

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

This will prompt you for your password and then give some errors, but it does disable the built in keyboard (tested on my ML 10.8.2)

To re-enable the builtin keyboard, load the kext file again:

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

BTW, I noticed that this immediately prints all that was typed on the builtin keyboard, so be ready for this (in Terminal this should probably just output some text).

  • 3
    Does this still work for you on OS X Mavericks 10.9.1? It used to work for me before, but now I'm getting: (kernel) Can't unload kext com.apple.driver.AppleUSBTCKeyboard; classes have instances: (kernel) Kext com.apple.driver.AppleUSBTCKeyboard class AppleUSBTCKeyboard has 1 instance. Failed to unload com.apple.driver.AppleUSBTCKeyboard - (libkern/kext) kext is in use or retained (cannot unload). – john2x Dec 20 '13 at 2:15
  • 2
    I’m getting the same error as @john2x but it does seem to be working despite the warning. – Leo May 16 '14 at 17:34
  • 2
    Just a quick note that this also works under Yosemite, despite the warnings. – snipe Oct 24 '14 at 3:54
  • 2
    This seems to cause a kernel panic on El Capitan Public Beta. – Gabriele Cirulli Jul 11 '15 at 16:41
  • 1
    Yeah this stopped working for me too only recently. I need to disable it because I can't afford to get my laptop fixed yet and occasionally it types random keys while a large chunk of them have stopped working altogether. So I use a BT keyboard for now. But it worked fine up until a few weeks ago. I get the same message john2x gets. Something about it being in use or retained. I'm almost tempted to delete the AppleUSBTopCase.kext bundle itself as a last resort but I don't know what else it might control. So of course I don't take the risk. – Jason Anderson Jan 30 '17 at 22:51
24

Reddit Source

  • 1
    This seems a much bigger solution than necessary for such a simple task. – jtheletter Mar 30 at 19:20
  • v12.2.0 has a convenient checkbox to automatically disable the internal keyboard when a different keyboard is connected. Now I can place my magic keyboard on top of my non-working-piece-of-trash butterflunk keyboard. Works like a charm! – jlmmns Apr 17 at 7:49
  • Enabling this feature in Karabiner didn't work for me on 10.14 Mojave. Additionally, the latest version of Karabiner is called "Karabiner-Elements" and does not include this feature so I suspect it's been disabled by the underlying OS. – donturner Jul 4 at 16:51
2

There is a little utility called Keyboard Cleaner and it seems to work fine for me on 10.10.5. You run the program and only cmd + q stay functional to then quit it.

http://jan.prima.de/~jan/plok/archives/48-Keyboard-Cleaner.html

  • Keyboard Cleaner emits the macOS System error "funk" sound upon keypresses, which could be annoying to users. – jtheletter Mar 30 at 19:32
  • didn't work, is this a virus? – kaushik gandhi Sep 27 at 2:11
0

KeyboardCleanTool is like Keyboard Cleaner, but instead of dropping a curtain that takes all the strokes, it disables it through Accessibility API. Main advantage is it also blocks media keys and doesn't produce sounds when keys are hit. Nothing works except power button.

  • My only complaint is minor, that it doesn't also disable the trackpad for cleaning. I'd rather it unlock by a command-key combination. – jtheletter Mar 30 at 19:29
  • I just tried keyboardcleantool. It only blocks the keyboard while the app is in the foreground. If you switch to other apps, the keyboard is not blocked. – Quinn Comendant Apr 18 at 18:23
  • @QuinnComendant just tried it and I'll have to disagree on that. I'm on 10.13, so APIs might have changed in newer OSes. – seeker_of_bacon Apr 18 at 19:41
  • @seeker_of_bacon I'm on 10.13.6, and I can't get it to work. It's pretty simple software, I don't think I could be using it wrong. Instead, I installed Karabiner-Elements and it works great; auto-disabling when an external keyboard is attached is really useful. – Quinn Comendant Apr 24 at 5:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .