everyday mac tools

A faster key repeat rate than System Settings allows

· 6 min read

System Settings has two sliders for key repeat, and both stop well short of what macOS can actually do. Two preference keys, KeyRepeat and InitialKeyRepeat, go past the end of each slider. A third setting decides whether holding a letter key repeats it at all, which is the part that catches out people who edit text or code.

Set the sliders first

System Settings, Keyboard.

  • Key Repeat: drag all the way right, to Fast. The far left position is Off, which stops repeat entirely.
  • Delay Until Repeat: drag all the way right, to Short.

For a lot of people this is the whole job. If you hold an arrow key to move through a paragraph, or hold Delete to clear a line, the difference is obvious within a minute. Do this before touching Terminal, because the sliders write the same two values you are about to edit, and moving a slider afterward overwrites whatever you set.

What the two numbers mean

Read them back:

defaults read -g KeyRepeat
defaults read -g InitialKeyRepeat

If Terminal says the domain or the key pair does not exist, the value has never been set on this Mac. Move the slider once and read again.

Both are counted in ticks of roughly 15 milliseconds. KeyRepeat is the gap between repeats once a key has started repeating. InitialKeyRepeat is how long you hold before it starts. The fastest slider position usually writes a KeyRepeat of 2, about 30 milliseconds between characters, and the shortest delay writes an InitialKeyRepeat of 15, about 225 milliseconds. Check the values on your own Mac rather than trusting the numbers here; it is one command.

Go past the end of the sliders

defaults write -g KeyRepeat -int 1
defaults write -g InitialKeyRepeat -int 10

1 is roughly 15 milliseconds per repeat, about twice as fast as the fastest slider position. 10 is roughly 150 milliseconds before repeat begins.

Log out and back in. Apps read these values when they launch, so a running app keeps the old behavior until you restart it, and the login window itself does not update until you log in again.

Change one at a time. A very short initial delay is the change most people feel first, and it is also the one most likely to cause trouble: a key you tap slightly too long starts repeating. If you find yourself pressing Command-Z more than usual, raise InitialKeyRepeat back toward 12 or 15 and leave the repeat rate fast.

At KeyRepeat 1, holding Delete clears a line faster than you can react to it. That is the point, and it is also a real hazard in a document. Try 2 first, live with it for a day, and only then decide whether 1 is better. Do not set either value to 0; there is nothing to gain and the behavior is not defined.

The setting that stops repeat entirely

Hold a letter that has accented forms and macOS shows the accent picker instead of repeating the character. For writing in languages that need those accents it is the right default. For editing text or code it means a held key does nothing at all, which reads as the repeat settings having failed.

defaults write -g ApplePressAndHoldEnabled -bool false

Log out and back in. Accented characters are still available through Option key combinations and the Emoji & Symbols picker (Control-Command-Space), so you are not losing access to them, only the hold-to-choose shortcut.

You can also change it for one app rather than the whole system, using that app’s bundle identifier:

defaults write com.example.appname ApplePressAndHoldEnabled -bool false

Find an identifier with osascript -e 'id of app "Name Of App"', using the app’s exact name. This is the version worth using if you want repeat in your editor and the accent picker everywhere else.

When the change does not take

In rough order of likelihood:

  1. You did not log out. This is nearly always the answer.
  2. The app handles keys itself. Terminals, code editors and remote desktop clients often implement their own repeat behavior and ignore the system values.
  3. You are typing into a virtual machine or a remote session, where the guest system’s settings apply instead.
  4. The Mac is managed and a configuration profile is reimposing keyboard settings. If you cannot change them, that is why.

One thing that is not the cause: the keyboard itself. Key repeat on macOS is a per-user system setting, not a per-keyboard one, so a built-in keyboard and an external one share the same rate.

Put it back

defaults delete -g KeyRepeat
defaults delete -g InitialKeyRepeat
defaults delete -g ApplePressAndHoldEnabled

Log out and back in. Moving either slider in System Settings also rewrites the first two keys, so you can undo those without Terminal at all. What defaults write does and how to undo one safely covers reading a value before you change it, and what a delete actually removes.

Doing it with a switch

If you would rather not keep these key names in your head, Mainspring (https://trymainspring.com/) has fast key repeat as one of its power-ups, each one a real macOS setting with a plain-English label and a recorded previous value so a second click reverts it. The same list includes the typing settings that usually get changed alongside it: autocorrect and smart quotes off, all file extensions shown. It is $29 once for up to three Macs, with a one-day trial that holds nothing back.

Nothing there is beyond a Terminal line. The case for it is the revert, particularly on a Mac you share or hand on. If you are already comfortable with defaults, two commands and a log out will do.

While you are in the typing settings, turning off autocorrect, smart quotes and substitutions is the other change people who write code end up making.

Questions

Is there any risk in going faster than the sliders allow? No, in the sense that nothing breaks and it is one command to undo. The practical risk is overshoot: held keys do more than you intended, particularly Delete and the arrow keys. That is a matter of tuning, not damage.

Why do I have to log out? The values are read when an app launches, and by the window server at login. Restarting individual apps gets you most of the way there, but logging out is the reliable way to see the setting everywhere at once.

My Terminal still repeats at the old speed. Why? Terminal emulators and shells commonly handle key input themselves, and what repeats in a shell may be the shell’s line editor rather than macOS. Test the setting in a plain text document first to confirm it took, then treat the terminal as its own case.

Does a keyboard with its own software override this? A keyboard with onboard firmware can send repeats itself, in which case macOS never sees a held key. If your rate does not change no matter what you set, check whether the keyboard is doing the repeating.