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?– binarybobOct 14, 2012 at 18:40
-
1I 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.– timmfinFeb 6, 2013 at 18:19
4 Answers
Install Karabiner
Choose your external keyboards on Devices > Advanced.
Check the corresponding box
-
1This seems a much bigger solution than necessary for such a simple task.– 2540625Mar 30, 2019 at 19:20
-
18v12.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!– jlmmnsApr 17, 2019 at 7:49
-
1Enabling 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. Jul 4, 2019 at 16:51
-
4Complementing @jimmns, today in Karabiner, after connect the external keyboard, go to Karabiner Elements preference > Devices > Advanced.. now you can see the checkbox. Feb 9, 2020 at 14:18
-
1Karabiner has been updated see the latest instructions here pqrs.org/osx/karabiner/document.html#disable-built-in-keyboard Feb 25, 2020 at 14:58
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).
For newer versions on MacOS / alternative solution:
List loaded kexts for keyboard
kextstat | grep Keyboard
It's going to output something like:
81 0 0xffffff7f833c5000 0xb000 0xb000 com.apple.driver.AppleHIDKeyboard (208) 96DDE905-9D31-38A9-96B7-FB28573587C8 <43 6 5 3>
com.apple.driver.AppleHIDKeyboard
is loaded kext identifier.
If you want to plug-in Apple Magic Keyboard / some other Bluetooth keyboard, turn it off first. Then follow the instruction below.
To disable keyboard:
sudo kextunload -b com.apple.driver.AppleHIDKeyboard
To enable it back:
sudo kextload -b com.apple.driver.AppleHIDKeyboard
-
6Does 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).– john2xDec 20, 2013 at 2:15
-
3I’m getting the same error as @john2x but it does seem to be working despite the warning.– LeoMay 16, 2014 at 17:34
-
2Just a quick note that this also works under Yosemite, despite the warnings.– snipeOct 24, 2014 at 3:54
-
2
-
3Not working for me:
(kernel) Kext com.apple.driver.AppleUSBTCKeyboard not found for unload request. Failed to unload com.apple.driver.AppleUSBTCKeyboard - (libkern/kext) not found.
– tdcJan 13, 2020 at 20:33
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
-
1Keyboard Cleaner emits the macOS System error "funk" sound upon keypresses, which could be annoying to users.– 2540625Mar 30, 2019 at 19:32
-
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.– 2540625Mar 30, 2019 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. Apr 18, 2019 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. Apr 18, 2019 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. Apr 24, 2019 at 5:30