macOS dialog shortcut keys
You probably know that I’m a big fan of keyboard shortcuts. I try to learn them all and rarely click a button or pull down a menu. There’s one area where I had a big question I had to pose to Twitter: how do I trigger the “Delete” button in an “Are you sure you want to close…” dialog. I got the answer from Sören Kuklau: ⌘⌫. I figured that, since those are harder to find, I’d write out a few of my favorite dialog box shortcuts.
Full Keyboard Access
First, if you have Full Keyboard Access set to “All Controls” in System Preferences -> Keyboard -> Shortcuts (at the bottom), you can use Tab and Shift-Tab to navigate all the buttons in a dialog. The fully highlighted button (which won’t change while tabbing) responds to Return, and the one with the highlighted outline responds to Space.
Don’t Save
Just like it has been for as long as I can remember, if the “Do you want to save…” dialog’s button reads “Don’t Save,” ⌘D will choose that option directly.
Cancel
In most dialogs you can use Escape to cancel, but not always. More reliably, you can trigger the “Cancel” button with ⌘. (Command-period), which is also old school. It was originally the “interrupt” command for canceling long-running actions in applications (and still is in some, such as Logic Pro X).
Delete
When you close an unsaved document in apps that are set up as document based apps, instead of “Don’t Save,” the dialog’s ignore button reads “Delete,” indicating that if you choose not to save or cancel the action, the document will never be written to disk. The shortcut for that button is ⌘⌫ (Command-Delete).
Other Shortcuts
In any save or open dialog, you can trigger the field that lets you manually enter a path (with Tab completion) using ⇧⌘G, or just typing a tilde (~) or slash (/). Typing a tilde will open the field with a tilde in the text field, which is a shortcut to your user’s home folder. A slash starts at the root of the filesystem, handy for getting to /Volumes/other disk
.
You can toggle the display of hidden files with ⇧⌘. (Command-Shift-period).
All of the Finder folder shortcuts work, for example:
- ⇧⌘H for Home
- ⇧⌘D for Desktop
- ⌥⌘L for Downloads
- ⇧⌘O for Documents
You can see all of the shortcuts for folders by opening Finder and pulling down the Go menu in the menu bar.