Updated June 16th, 2019.
Once you’ve tried moving through Mac dialog boxes with the keyboard you’ll never go back to mousing around or using the trackpad. Here’s how you do it.
Most Mac dialog boxes have a Cancel button, which you can click by pressing esc (Escape) on the keyboard. That’s an easy key to hit as it’s usually at the top left corner of the keyboard. One tap of the Escape key and the dialog box goes away. Usually.
The “default button” (the one that’s either heavily outlined, or blue) can be triggered with Return or Enter. Enter is the easier key to type thanks to its position at lower right (at least on keyboards with numeric keypads). Return is pretty easy to hit also, since it’s usually a pretty big key.
The Tab key will take you from place to place in the dialog box. It highlights whatever is in the box that you tab into, so you can just type over it (no need to press Delete first).
Tabbing normally goes from box to box, left to right, top to bottom. Do it enough times and you’ll loop around to the top again.
Shift-Tab goes backward.
Tabbing will highlight every item in a dialog box, including every button, if you turn on Full Keyboard Access in System Preferences/Keyboard/Shortcuts (in Mojave) and choose the “All controls” option. Trigger a selected button (or checkbox, or radio button) after tabbing to it using the space bar.
One more thing: often, you can trigger buttons in a dialog box by typing the first letter of that button, sometimes with the Command key down, sometimes without. Experiment! it will save you gobs of time once you figure out what works in the apps you use the most.