Re-enabling Repeating Keys In Yosemite

When programming, I and millions like me like to keep my hands on the keyboard and minimize the number of times that I have to spend time going through the process of lifting my hand off the keyboard to reach for the mouse, do something with the mouse, and return the hand to the keyboard. Being able to perform all editing functions from the keyboard is very efficient.

Thus, if an environment supports something like vim emulation, I’m all over it.

After upgrading to Yosemite I found that navigating in my JetBrains IDEs vim was dead. Even though key repeating is set in the keyboard preferences, keys won’t repeat. Worse, letters that can take accents pop up a menu that then expects me to choose and accent, e.g.


Press and Hold Popup Menu

I recognize this as behaviour derived from iOS devices, and can sympathize with non-programmers scratching their head asking, “Why would anybody want keys to repeat? There are no words that contain kkkkkkkkkkkkkkkkkkkkk.” But, they are not programmers using keyboard navigation.

To disable this behaviour, enter the following command in a terminal.

defaults write -g ApplePressAndHoldEnabled -bool false

You’ll need to restart your programs to pick up this new default behaviour, however.

Apparently this new behaviour appeared in Lion, but with Yosemite is seems to be a default forced on everybody.

31 thoughts on “Re-enabling Repeating Keys In Yosemite

  1. Ryan

    Muchos gracias! I’m surprised this wasn’t a checkbox beside the Keyboard Repeat/Delay rate controls!

  2. Cravecode

    bah! thank you so much! Also thank you for whatever SEO forethought. I had no clue what would be needed to search for this and you were the top listing.

  3. rfknqxec

    Can you do it only for intellij instead of system-wide? “defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false” does NOT seem to work for intellij 14 on yosemite

  4. Geebo Harris

    This “feature” first appeared back in Lion, but I don’t think it was on by default. The fact that it’s still not a System Preferences option in Yosemite just highlights how poor support for OS X has become.

  5. Giulia

    I can’t get to make it work… is anyone experiencing the same problem? Any clue? I’m new to Mac but I’m pretty sure I did exactly what you wrote, I also switched the computer off and on again.

  6. Mark

    Hi James thanks for the fix. How do I cancel the Keyboard repeat in order to get back to the Press and Hold Pop Up Menu

  7. James Reuben Knowles Post author

    Guilia ~ I’m not in a position to play technical support, but try again.

    Be sure to restart your apps.

    If it doesn’t work, copy/paste your command into the comment section.

  8. Mark

    Awesome thanks James. I find the repeat is useful but I also like the choice pop up as I often switch different languages for typing on my uk qwerty keyboard, accents in french and spanish and special letters for swedish, etc …

  9. Tom Hultgren

    This post has a lot of recent replies, and shows up when searching this issue online, 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.

    Pardon me for being a space hog, but I hope you find it worth it.

    — © 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. ??????
    — ++++++++++++++++++++++++++++++++++++++++++++++++++

    tell application “Finder”


    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


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

    end if

    set message1 to “”


    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.


    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


  10. Tara

    Thank you, thank you! This has been driving me crazy for so long. Karma points for sharing the command.

  11. Ken Newman

    WOW!! I just now upgraded to Yosemite, and this was going to drive me bat crazy, but thanks to YOU, it’s all good!! Thank you SOOOOOOOO much for sharing!!!!

  12. David

    I tried the defaults etc. solution on Terminal several times, but it did not work. I am using a gamer keyboard on a Mac Mini. Key repeat works fine when I use this keyboard on Windows. Is there anything else that I can do

  13. Tom Hultgren

    I’m a little confused. It is January 7, 2016 and I just received an email notice of your post dated 25 December. Believe me I share your enthusiasm on finding the fix for this problem. Since yours is a current post I thought I might ask you a question. I haven’t received any comments to know if anyone has tried my AppleScript solution. I was wondering if you may have tried it. I am running OS 10.11 (El Capitan). Apple hasn’t made a system preference to toggle key repeat yet. My AppleScript still works as a replacement since the terminal command still works with OS 10.11. I’d appreciate any feedback.

  14. Tom Hultgren

    I just received a notice of your post of December 26 today – 01/07/2016. In case you haven’t found a solution to your problem, I thought I’d see if I might help. Please pardon my “First, is the computer plugged in?” style of inquiry. First, be sure there are no apps that use text input open before or you close and reopen text apps after you issue the terminal command. You don’t say whether your keyboard is Apple or PC style. I’ll assume it’s for PC gaming but it may not matter. Of course, probably the best solution would be to buy an Apple compatible keyboard. But… I connected a Logitech wireless STANDARD PC keyboard to my Mac Pro running OS 10.10. The Mac recognized that the keyboard was not a standard Apple keyboard and asked me to press the Ctrl and Alt keys to map those as Apple keys. The keyboard acted like an Apple keyboard after that. Keyboards in general are just a bunch of switches sending a signal to the computer. It’s the software that interprets the signals. Since gaming keyboards are specialized I believe they need their own specialized drivers. Make sure you have the latest driver for your keyboard whether it is designed for Apple, PC, or cross platform (came with drivers for Mac and PC, doubtful). In any case there may be a conflict with the Mac OS. If you have a Mac compatible gaming keyboard the key repeat fix should work unless the driver is prohibiting that. You may have to get a standard Mac keyboard for your Mac Mini. Not knocking your computer skills but terminal commands have to be very precise. You may want to try it again. You may want to try using my AppleScript solution which makes toggling the key repeat function fairly idiot proof. In any case, without any more details about your problem, I think it’s the gaming keyboard that is the main problem and maybe you should contact the manufacturer. At any rate, good luck. I hope I helped a little. Let me know, if you get the chance, if you found the solution.

  15. dthree

    THANKS! The defaults command works in El Capitan. I tried the applescript, but it gave me an error at first. It seemed to work the second time however. Also, i had to change all the curly quotes to straight quotes. Maybe wordpress changes those when publishing a comment.

  16. Tom Hultgren

    Re dthree: I’m glad you got my AppleScript to work. I wished I could have just uploaded the app version here somehow. I didn’t try to copy and paste the script into Script Editor after I posted it here. Note: in El Capitan AppleScript Editor is now just called Script Editor. I didn’t notice that all the straight quotes got changed. I’m sure WordPress was the culprit. Unfortunately the script won’t compile with curly quotes. Fortunately you can do a global Find and Replace to change the quotes to straight quotes. Unfortunately you have to change left and right curly quotes separately. Sorry for that little bit of extra work. I hope everything is OK now. Thank you for your feedback. I learned something and I hope this post serves to help others who want to try my AppleScript. I didn’t mean to add extra frustration to the already frustrating key repeat problem.

Leave a Reply