macOS provides functionality to cycle through dialog boxes, but there is a system setting that must be enabled.
Toggle Functionality with Keyboard Shortcut
Press Control-F7
System Settings (macOS Ventura and later)
Starting with macOS Ventura, the setting is in System Settings → Keyboard → Keyboard Navigation. Click the toggle to enable the setting.

System Preferences (macOS Monterey and earlier)
In macOS Monterey and earlier versions, the setting is in System Preferences → Keyboard → Shortcuts → Full Keyboard Access... → All Controls

Keyboard Control Tips

Now you can navigate dialogue boxes using the keyboard:
- Press Tab to move the focus the next button on the dialog.
- Press Shift-Tab to move back to the previous button.
- Press Space to trigger the currently selected button (highlighted border).
Regardless of which control is currently selected:
- Pressing Return will always trigger the default button (highlight-coloured button).
- Pressing Esc will always cancel the dialog.