Many user interface (UI) elements or dialog boxes have buttons. I would like to be able to activate a button with just the keyboard, without the mouse. How can I do this?
7 Answers
Enable Keyboard Control of the UI
System Prefs > Keyboard > Shortcuts
Then select "All Controls" radio button at the bottom, rather than just "Text boxes and lists only".

Keyboard Shortcuts
- ⇥ (TAB) will move between buttons.
- esc (ESC) is cancel.
- space (SPACE) selects the active button (blue, outline).
- ↩ (RETURN) is OK or the default button (blue, pulsing, filled).
- For some dialog boxes, ⌘+first_letter will select the button with a certain first letter in the text (as pointed out by @Griffo).
- 337
- 3
- 10
-
Is this still applicable to Mavericks? – Jayden Lawson May 13 '14 at 07:09
-
@JaydenLawson Yes, can confirm it's working on Mavericks. I don't know about Yosemite – Mohsen Jun 28 '14 at 02:25
-
6It is actually under the "Shortcuts" tab. System Perfs > Keyboard > Shortcuts – Chris Watts Aug 27 '14 at 17:22
-
As @ChrisWatts said... these instructions are a little outdated, but still work as of El Capitan. these instructions ARE the most reliable way to achieve what OP said. The accepted answer isn't reliable. – Cyprus106 Oct 19 '15 at 15:30
-
4This is definitely the correct answer. – Wesley Smith Jul 21 '16 at 06:08
-
2This is the correct answer. It works perfectly on macOS High Sierra. – alezvic Apr 26 '18 at 00:05
-
2This works on the latest macOS Mojave. Thanks~ – jdhao Oct 12 '18 at 17:05
-
1In macOS Catalina, the checkbox is now labeled "Use keyboard navigation to move focus between controls" and was unchecked by default (which seems to be against the spirit of accessibility). – user110857 Oct 01 '20 at 16:32
For many dialog boxes you can select the option you want by pressing ⌘+firstletter where firstletter is the first letter of the option you want to select
- 16,501
- 8
- 46
- 65
-
3
-
7I haven't been able to get this to work once. What dialog boxes support this? What percentage of the time does this work for you given all the apps you use? – Feb 13 '11 at 20:38
-
1@mankoff Try it while carrying out what the original question asked and it works – conorgriffin Feb 13 '11 at 20:49
-
I have "warn when changing" unselected so I never come across that dialog. In testing, CMD+K (keep) doesn't seem to work for me, only CMD+U (use). This answer, while useful when it works, seems to be only partially and occasionally valid. – Feb 13 '11 at 20:59
-
13
-
As @fredley mentioned, this is not often the case. actually AFAICT it is rarely the case. Really really too bad. – WestCoastProjects Aug 16 '13 at 22:20
-
1Yup, unfortunately when I answered the question I tested it in the specific scenario the question described and it worked but it's not universal I'm afraid. Pity... – conorgriffin Aug 27 '13 at 23:55
-
2This works in Sequel Pro. I found it very non-intuitive, which is how I ended up here. Thank you! – Jonathan Nesbitt Jan 22 '15 at 19:49
-
I've found this to work in Office, but actually, you don't need to use
commandthere. – Louis Waweru May 22 '15 at 04:32
To elaborate on the answers above, many (most?) dialogue boxes will have the default option in blue. Hitting ⇥ will cycle between options, with a blue outline around the other button, but the default will remain blue. Hitting ↩ will always select the default, space will select whichever button is highlighted.
In this example, pressing ↩ will 'Keep .txt' and pressing space will 'Use .bak.'

In macOS Big Sur (version 11.3+), System Preferences > Keyboard > Shortcuts
Select Use keyboard navigation to move focus between controls
@Eric Leschinski's answer gives an overview of keyboard shortcuts
- 141
See full Keyboard Access at the bottom of the following screenshot:
When a prompt window like the one you included appears, the selected button will be highlighted in blue.
Screenshot:

Then you press the space to action that button.
- 16,501
- 8
- 46
- 65
-
1Thanks @Am1rr3zA for the previous edit but I discovered my answer didn't work so I amended it. ;o) – conorgriffin Jan 31 '11 at 23:49
Tab to move to the next dialog box. Space to select
- 145
-
1As stated by the answers above, this doesn't just work out of the box. You have to enable it in System Preferences. – daviesgeek Aug 18 '12 at 06:19
-
@daviesgeek — And Tab does not switch dialog box ! Fortunately. – Nicolas Barbulesco Jan 31 '15 at 17:41
