key-repeats

One thing I’ve always liked about Macs is their secondary keys, where holding down a letter key will display variations of that letter, like holding down “u” to get “ü.” This comes in handy when spelling non-English words, but if that’s not something you ever do, Apple’s substitution of special characters for the traditional key repeats of Windows computers can be an unneeded – and perhaps unwanted – feature.

The good news is that there’s a simple way to take control and change the behavior of long key presses to accommodate your needs. This not only works with letters, but number keys as well.

Turn on key repeats on Mac

Step 1: Open Terminal. This can be done by searching for “Terminal.app” in Spotlight or by locating it in the Applications folder. Your version of Terminal may look different from mine, and that’s ok.

Spotlight-Terminal-Yosemite

Step 2: Enter the following command into Terminal and press enter:

defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

key repeats terminal

Step 3: Restart any open applications in which you want this setting to activate. You should now be able to hold down a key and have it repeat its character indefinitely.

enable key repeats on mac

Step 4 (optional): If you want to speed up the rate of key repeats or decrease the delay before a held key starts repeating, System Preferences has these options filed under the ‘Keyboard’ header. Simply adjust these sliders to suit your taste.

key repeat preferences

Reverting back: If you don’t like the results or want to get back the alternate characters for whatever reason, doing so is as simple as following the above steps but changing the latter part of the command from “false” to “true”. This simply means substituting the following command for the one in step 2:

defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool true

alternate-keys

That’s all it takes. Whether you like key repeats or simply dislike alternate characters, toggling between these settings is a breeze.

  • Shawn

    This post came at a funny time. My friends were complaining that there wasn’t an option for it just yesterday.

    • No more reason for your friend to complain then 🙂

      • Jonathan

        Sometimes I swear you watch what I Google. xD 3 times you posted something the next day that I was curious about or had a question on.

  • DevXav

    Excellent!!!
    Thank you very much, just enabled it! 🙂

  • Damn them restrictions, this should be a simple switch easily configurable via the settings panel > Keyboard, even better with keyboard shortcuts to toggle it.

  • Tom Hultgren

    SAVED BY THE SHELL!

    This post has some fairly recent replies, so it seems the age old question of “Where did my key repeat go?” is still an issue. I used the Terminal command when I updated to Mountain Lion and again updating to Yosemite. But! Being an AppleScript guy I just had to make a no-fuss no-muss easy solution to toggle the setting. You do have to remember your password and be an administrator user though. Using “do shell script” in AppleScript eliminates using Terminal. Copy the following script and paste it into a new Script Editor document. Compile (Cmd K) and save the document as an application in a handy place. You could link it as a Dictation command. Run the app any time you want to switch the key press behavior! BTW you don’t have to copy my rant into the Script Editor. As far as I have tested, you only need to restart any app that is open that uses text entry. You don’t need to restart you computer.

    — KEY REPEAT OR POP-UP v-A1
    — © 2015 Thomas Hultgren
    — No restrictions for personal use.

    — ++++++++++++++++++++++++++++++++++++++++++++++++++

    — Apple now thinks desktop computers should act like iPhones and tablets.
    — The current default in OS X is only a few characters will repeat.
    — How about programmers, artists, or anybody that uses rows of characters
    — to put separators in an email, etc. ??????
    — APPLE! MAKE IT A KEYBOARD SYS PREFERENCE OR A FUNCTION KEY!!!!!!!

    — ++++++++++++++++++++++++++++++++++++++++++++++++++

    tell application “Finder”

    activate

    set currentState to “”

    set DefaultButtonHilight to 0

    — reading the setting does not need a password but needs administrator privileges!

    set repeatOrPopState to do shell script “defaults read -g ApplePressAndHoldEnabled with administrator privileges”

    set repeatOrPopState to repeatOrPopState as integer

    — display dialog “repeatOrPopState = ” & repeatOrPopState buttons {“CANCEL”, “OK”} default button 2

    if repeatOrPopState = 0 then

    set currentState to “KEY REPEAT is the current state.”

    set DefaultButtonHilight to 2

    else

    set currentState to “POP-UP MENU is the current state.”

    set DefaultButtonHilight to 3

    end if

    set message1 to “”

    beep

    display dialog “Select KEY REPEAT or POP-UP Key Press Behavior” & return & return & ” >>> ” & currentState buttons {“CANCEL”, “POP-UP”, “REPEAT”} default button DefaultButtonHilight

    set userChoice to the button returned of the result

    if userChoice is “CANCEL” then

    error number -128

    end if

    if userChoice is not “CANCEL” then

    — The password is used to enable changing the setting.
    — Adding “with administrator privileges” is not needed
    — and actually causes the shell script to fail.

    beep

    display dialog “PLEASE ENTER YOUR PASSWORD” default answer “PASSWORD” buttons {“CANCEL”, “ENTER”} default button 2

    copy the result as list to {button_pressed, text_returned}

    if button_pressed is “CANCEL” then

    error number -128

    end if

    set myPassword to text_returned

    if userChoice is “REPEAT” then

    do shell script “defaults write -g ApplePressAndHoldEnabled -bool false” password myPassword

    set message1 to “KEY REPEAT IS ON”

    end if

    if userChoice is “POP-UP” then

    do shell script “defaults write -g ApplePressAndHoldEnabled -bool true” password myPassword

    set message1 to “POP-UP IS ON”

    end if

    end if

    beep 2

    display dialog “–+++– ” & message1 & ” –+++–” & return & return & “Close any text apps to reset them!” buttons {“DONE”} default button 1 with icon 2

    end tell

    beep

  • Ich2222

    Thanks! But as key repeat works in Terminal without being activated, i don’t need it.

  • MacBiter

    There’s one thing you didn’t mention. It’s not a case of “either/or” (key repeat or special characters) – you can have both. I have activated the kkkkkey repeatttttt Terminal command but I can also use the Option key (as I always have) to get a á à ä â ø © œ † etc.

  • Sashineb

    This is very helpful, thank you. I’m not used to using Terminal, so I hope this doesn’t sound stupid: does the Terminal file have to be saved after the command has been entered? If so, where should I save it? I’m asking, just wondering if this will work the next time I start the computer, or if the Terminal command has to be re-typed for each login session. Thank you.

  • shayneo

    This actually gave me a solutiion to a different problem. I’ve had serious troubles with a particular keyboard occasionally flipping out and repeating keystrokes.. So I turned it *on* and the problem was solved

  • catherinedevlin

    Thank you, you just healed one of my larger annoyances with Macs!