Disable the internal keyboard of a MacBook Pro I'm looking for a solution to completely disable the internal keyboard of my MacBook Pro 13" Model A1278 (MacBookPro8,1).

I have no idea how it happened but when it is on, randomly, some letters are pressed without interruption for several minutes. So it is pretty much impossible to use it unless I find a way to disable the internal keyboard and use an external one (wired or wireless).
From this post on MacRumors forums:


  To disable the Macbook keyboard, type (or copy and paste) the following into terminal:

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

  
  To re-enable it, type (or copy and paste) the following into terminal (if copying and pasting, don't forget to copy a linebreak to make the command work):

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

  
  External keyboards will still work.


Tested to work on macOS High Sierra 10.13 and macOS Mojave 10.14.



Alternatively, you can use Karabiner, a 3rd party app for macOS has a feature which lets you automatically disable the internal keyboard of your MacBook when an external one is connected.