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.

This entry was posted in Mac. Bookmark the permalink.

31 Responses to Re-enabling Repeating Keys In Yosemite

  1. axtor says:

    thanks pal! i hate Yosemite nowwwwwwwww heheeh

  2. dan says:

    Wonderful ! a lifesaver. A million thanks.

  3. Patrick says:

    Thank you! If we were on Stack Overflow I’d +1!

  4. I’m glad it was was helpful.

  5. jsdom says:

    that’s really save my life. now I’m happy with Intellij again. appreciate your help.

  6. Diana says:

    Life saver, thank you so much!

  7. Thanks so much for this. My MBPro came back from repair at the Apple Store and no keys were repeating. Very helpful.

  8. Ryan says:

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

  9. It seems this should be an option.

  10. castaway5555 says:

    Slicker ‘n sliced bread. Thanks.

  11. Cravecode says:

    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.

  12. rfknqxec says:

    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

  13. I need this behaviour system wide, so I’ve not attempted to target specific applications. I’m sorry that unable to answer this.

  14. Steve Bolton says:

    Genius! Thought I had broken my eclipse app.

  15. Ana says:

    Thank you dude! It was so annoying, but that command fixed it! 🙂

  16. Geebo Harris says:

    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.

  17. Giulia says:

    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.

  18. Mark says:

    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

  19. Mark, replace the last word “false” with “true”.

  20. 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.

  21. Mark says:

    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 …

  22. Tom Hultgren says:

    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


  23. Tara says:

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

  24. Anonymous Coward says:

    Thanks for the info! This ios-ification of OSX sucks more and more with every upgrade…

  25. Ken Newman says:

    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!!!!

  26. David says:

    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

  27. Tom Hultgren says:

    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.

  28. Tom Hultgren says:

    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.

  29. dthree says:

    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.

  30. Tom Hultgren says:

    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