Skip to content

Instantly share code, notes, and snippets.

@hofmannsven
Created December 6, 2017 00:32
Show Gist options
  • Save hofmannsven/ff21749b0e6afc50da458bebbd9989c5 to your computer and use it in GitHub Desktop.
Save hofmannsven/ff21749b0e6afc50da458bebbd9989c5 to your computer and use it in GitHub Desktop.
Increase key repeat rate on macOS

Increase key repeat rate on macOS

Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat

Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.

Source: https://apple.stackexchange.com/a/83923

defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
@varenc
Copy link

varenc commented Aug 9, 2020

Anyone know how to change the repeat rate WITHOUT restarting? When you change it in System Preferences it takes affect immediately.

@ZaymonFC
Copy link

ZaymonFC commented Mar 2, 2021

@varenc I made a little in browser tool to simulate the settings without restarting over and over. It generates the commands for you too:

Tool: https://mac-os-key-repeat.vercel.app/
Repository: https://github.com/ZaymonFC/mac-os-key-repeat

@hofmannsven
Copy link
Author

@ZaymonFC Wow! Amazing! Very helpful!

@nclsndr
Copy link

nclsndr commented Mar 13, 2021

Thx guys for those resources!

Doing some investigation upon the topic, I discovered there are 2 sets of defaults:

The global (described in this gist):

Apple Global Domain
    InitialKeyRepeat = 35;
    KeyRepeat = 2;

The Accessibility values:

com.apple.Accessibility
    KeyRepeatDelay = "0.5";
    KeyRepeatEnabled = 1;
    KeyRepeatInterval = "0.083333333";

Do you have an idea on how those keys are impacting the OS or 3rd party apps?

@hofmannsven
Copy link
Author

@nclsndr I never had any issues with my settings above (I didn't change the accessibility values).

@varenc
Copy link

varenc commented Mar 14, 2021

@nclsndr I suspect that those settings control something else? I say that because my com.apple.Accessibility.KeyRepeatEnabled is 0 but of course hold-to-repeat actually works. My guess is that this "KeyRepeat" only refers to some accessibility feature that might have key repeat.

Also I noticed that on my Mojave machine those keys don't exist at all, but they do on Catalina. Catalina introduced a bunch of new accessibility features so my guess is it's related to one of those. I'd be curious to hear if you figure this out!

$ defaults read com.apple.Accessibility.KeyRepeatEnabled
{
    AXSClassicInvertColorsPreference = 0;
    AccessibilityEnabled = 1;
    ApplicationAccessibilityEnabled = 1;
    AssistiveTouchScannerEnabled = 0;
    CommandAndControlEnabled = 0;
    DarkenSystemColors = 0;
    DifferentiateWithoutColor = 0;
    EnhancedBackgroundContrastEnabled = 0;
    FullKeyboardAccessEnabled = 0;
    FullKeyboardAccessFocusRingEnabled = 1;
    GrayscaleDisplay = 0;
    InvertColorsEnabled = 0;
    KeyRepeatEnabled = 0;
    ReduceMotionEnabled = 0;
    VoiceOverTouchEnabled = 0;
    ZoomTouchEnabled = 0;
}

@nclsndr
Copy link

nclsndr commented Mar 25, 2021

Good to know! Thx for the inputs @varenc & @hofmannsven

@alexandre-g
Copy link

The issue I have with KeyRepeat is that you can't have it faster than 1. Doesn't accept floating-point values from what I saw.
Used to work around this using Karabiner (actually not Karabiner but the app that it replaced) but that was apparently not possible anymore since some MacOS version.

I imagine the com.apple.Accessibility. KeyRepeatInterval relates to key repeat speed on virtual accessibility keyboard
If anyone figures out how to increase key repeat interval beyond 1 please do reach out 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment