On extremely rare occasions, such as a moment ago, the keyboard on my MacBook Pro just stops working.
One moment ago I was using Space 4 to test something with TextEdit. Next moment, nothing I typed appeared in my document. The keystrokes went nowhere. Nothing happened.
I used my stylus and tablet (a mouse, or the trackpad would do) to pull up the Character Viewer and enter ‘keyboard’ as a search term in Evernote.
killall -9 Dock
That located the information I’d saved back in December when this last happened:
Here the quickest workaround yet:
- Start Automator
- Select Execute shell script
- type “killall -9 Dock” (without the quotes) as the script
- Save as an application, e.g. KillDock
- Put it in the Dock
Now you only have to select KillDock in the Dock each time the problem occurs.
The Terminal command
I didn’t bother with all that though. I knew I’d just lose the application, and be unable to find it when it was needed.
Instead I had previously entered the crucial Terminal command on a line by itself in an Evernote note, followed by a carriage return, so I could easily copy and paste if needed into Terminal:
killall -9 Dock ¬
Copy a Return
The carriage return at the end of a paragraph is invisible in many applications. I’ve marked it in the code above with a
¬, just to emphasise that it needs to be there.
The easiest way to be sure to have a Return at the end of the line is to type or paste the command into a text editor, such as TextEdit and press the Return key a few times.
Then copy the whole line and paste it into Evernote, or some other place where you can get to it only by using the mouse.
Run the command in Terminal
This time when the problem struck I switched to Evernote, located the command, copied (including the Return), started up Terminal, pasted. My keyboard function was restored. Hooray!
Don’t have Evernote?
I couldn’t work without Evernote to store all kinds of information for me. The free version meets my many needs.
But if you don’t use Evernote you could store the command in any text application: Stickies, as a text file, as a clipping that you drag into Terminal.