Currently, I am unable to login to a my MacBook—running Mac OS X 10.10 (Yosemite)—because they keyboard keys seemed to have been remapped somehow (probably my kids). The J key seems to type something and the H key seems to work as a backspace. I have to hook an external keyboard in order to be able to type anything. But even with the external keyboard some keys like A and L do not work.

Is there a way to reset the keyboard settings from the Terminal since I’m unable to login into any account?

| |
  • Sorry to hear about this. Have you checked out the answers in this post on Ask Different? – Giacomo1968 Oct 15 '15 at 19:09
  • I have looked at this, but cannot try those methods since I cannot log into OS X. I'm using the Terminal via the recovery partition to try commands. – Josh Oct 15 '15 at 19:13
  • Maybe renaming /Library/Preferences/ByHost/com.apple.HIToolbox.plist to /Library/Preferences/ByHost/com.apple.HIToolbox.plist.old and then rebooting? By renaming the file you essentially tell the system it does not exist and thus might regenerate it from scratch. – Giacomo1968 Oct 15 '15 at 19:18
  • I have been unable to figure out how to do this from the recovery partition. It tells me that the file cannot be found. I must not be doing something right. Maybe I need to mount a drive or something? – Josh Oct 15 '15 at 19:21
  • 1
    @JoshuaHowell Do I understand that correctly: You press one key and it types a command? See if the command, option, shift or ctrl keys are stuck by hitting them repeatedly. If d = d again, it was one of these keys. – user 99572 is fine Oct 15 '15 at 20:28

Is there a way to reset the keyboard settings from the Terminal since I’m unable to login into any account?

This post on Ask Different explores different ways of dealing with this when logged into Mac OS X. But if you are logging in via the Terminal in “Recovery Mode” you would have to adjust those procedures to match acting on a different volume.

For example, while that question and answer thread points to acting on this file:


But note that ~/ refers to your user’s home directory. But when you are logging in via the Terminal in “Recovery Mode,” you are not booting into your volume or even your user—obviously—but rather you are booting into a separate partition.

So you can adjust your user’s items on the system, but you need to modify paths so you can act on the files on your core system. So when you are logged in via the Terminal in “Recovery Mode” run this command:

ls /Volumes/

That will list all connected volumes associated with your machine. Now note your system’s true volume name which might be something like Hard Disk/. With that noted, you can then find your com.apple.HIToolbox.plist by exploring a path like this:

ls /Volumes/Hard\ Disk/Users/[username]/Library/Preferences/com.apple.HIToolbox*

Of course change [username] to match your username. So if it were just josh then the ls command would be:

ls /Volumes/Hard\ Disk/Users/josh/Library/Preferences/com.apple.HIToolbox*

Once you know what file you would be acting on, I would recommend a brute force renaming of that file—rather than editing—to force the system to regenerate the com.apple.HIToolbox.plist. I would proceed like this by first going into that directory:

cd /Volumes/Hard\ Disk/Users/josh/Library/Preferences/

Then renaming the file like this:

mv com.apple.HIToolbox.plist com.apple.HIToolbox.plist.old

The act of simply naming the file com.apple.HIToolbox.plist.old will make it effectively unknown to the system. So a new com.apple.HIToolbox.plist should be regenerated. And by simply renaming it—instead of just deleting it—you have a backup just in case something breaks.

Now all that said, I am not 100% sure dealing with com.apple.HIToolbox.plist would solve the issue. But at leas you now know that when you are using the Terminal in “Recovery Mode” you need to explicitly navigate to the file system of the main OS install to do any tweaks and adjustments.

| |
  • I tried using the "ls -la" method, but it didn't work. I was able to list all of the volumes by doing a simple "ls /Volumes/" command – Josh Oct 15 '15 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.