Create keyboard shortcuts for text on a Mac: typing the same line once
The request sounds simple. There is a block of text typed twenty times a week, and it should arrive from one key instead of from the clipboard. On macOS that request splits into two completely different mechanisms with different limits, and picking the wrong one is why the feature gets abandoned after a day. One inserts text as you type. The other binds a key to a command that happens to produce text. Knowing which one applies is most of the work.
Two different features share one name
The first mechanism is text expansion. A short trigger is typed, the system notices it, and the trigger is replaced with a longer string. Nothing is bound to a modifier key; the trigger is ordinary characters. This is what macOS calls Text Replacements, and it is what TextExpander and Espanso do at a larger scale.
The second mechanism is a key binding. A specific combination such as Control-Option-S is registered, and pressing it runs something: a menu command, a script, a shortcut. Text only appears because the thing being run happens to paste or type it. This is what App Shortcuts, the Shortcuts app and Keyboard Maestro do.
The distinction matters because the failure modes are opposite. Expansion breaks when an app does not route typed characters through the system's text engine. Key bindings break when something else has already claimed the combination. A setup that works everywhere usually means using both, with expansion for the long strings that are always the same, and a key binding for anything that needs a decision at the moment of insertion.
The built-in option, and its exact location
Apple's own text expansion lives in System Settings. The Mac User Guide gives the path in three steps: "choose Apple menu > System Settings, then click Keyboard in the sidebar", then "Click Text Replacements", then click the add button, enter the trigger and its replacement, and click Add.
It costs nothing, it needs no background process of its own, and it syncs across Apple devices, which means a trigger created on the Mac fires on an iPhone too. For addresses, bank details, standard sign-offs and long product names, this is the correct answer and there is nothing to install.
Two constraints are stated in Apple's own documentation and are worth reading before building a large list. The first: "Text replacements, smart quotes and dashes, and smart links aren't available in all apps." Apple does not enumerate which, which means the only reliable test is trying the trigger in the app where it matters. The second applies to anyone typing Japanese or Chinese: with those input sources active, text replacements are "included in your user dictionary" rather than managed as a separate list, so the same trigger behaves differently depending on which input source is live.
There is also a design limit rather than a bug. A replacement is a fixed string. It cannot place the cursor in the middle of the result, it cannot insert today's date, and it cannot ask a question first. Those three requirements are exactly where people leave the built-in feature for something else.
Binding a key to a menu command
The second mechanism has a built-in form too, and it is the least known feature in this whole area. Any menu item in any application can be given a keyboard shortcut, whether or not the developer provided one. Apple's guide describes the route as System Settings, then Keyboard, then Keyboard Shortcuts, then App Shortcuts, then Add, entering the name of the menu item and the key combination to use.
The catch is that the menu item name has to match exactly, including capitalisation and any trailing ellipsis. "Paste and Match Style" is not "Paste and match style". When a new binding silently does nothing, the name is almost always the reason.
This is the right tool when the text already exists as a command. A snippet stored in a note-taking app's menu, a template insert in a writing app, a "Paste as Plain Text" command buried three menus deep: all of these become one key, with no expansion engine involved and nothing running in the background.
Using the Shortcuts app, including from a terminal
The Shortcuts app on macOS covers the cases a fixed string cannot. A shortcut can assemble text from the current date, the clipboard, a prompt or the selected text, then paste the result. Shortcuts can be surfaced as Quick Actions in the Finder and the Services menu, or pinned to the menu bar, and those two are generated folders rather than folders you create.
Two details make Shortcuts more useful than it first appears. One is that scripting is off by default: Apple's guide states that to allow scripts you "Choose Shortcuts > Settings", then "Select Allow Running Scripts in the Advanced tab", with an explicit warning that "Running shortcuts with scripts could cause data loss."
The other is the command line interface, which is documented and stable. A shortcut runs with shortcuts run "Combine Images", or with the space escaped as shortcuts run Combine\ Images. Input files are passed with -i or --input-path, output is written with -o or --output-path, and the output type can be forced with --output-type followed by a Uniform Type Indicator. Existing shortcuts are listed with shortcuts list, folders with shortcuts list --folders, and a single custom folder with shortcuts list -f Music. Apple's documentation notes that -f works only with custom folders, "you cannot use generated folders such as 'Quick Actions,' 'Menu Bar,' and so on", and that the command "will exit 0 on a successful run or 1 on error". That last fact is what makes a shortcut safe to call from a script.
The third-party field, with current prices
| Tool | What it is for | Price as listed today |
|---|---|---|
| Espanso | Cross-platform text expansion | Free, open source under the GPL-3 licence |
| TextExpander | Shared snippet libraries for teams | Free plan at $0, Pro at $5 per user per month billed annually at $60 USD, Business at $10 per user per month billed annually at $120 USD |
| Keyboard Maestro | Macros triggered by keys, apps and events | US$36 one-time, US$25 to upgrade from earlier versions |
| Alfred | Launcher with snippets and workflows | Powerpack at £34 for a single user v5 licence, £59 for the Mega Supporter tier with free lifetime upgrades |
| Raycast | Launcher with snippets in the free tier | Free plan at $0, Pro at $8 per month billed annually at $96 |
Espanso is published as a cross-platform tool for Windows, macOS and Linux, licensed under the GPL-3.0 licence, which makes it the obvious starting point for anyone who wants expansion without a subscription and does not need sync built in.
TextExpander's free plan is deliberately narrow: the feature table lists five active snippets, one snippet swap every two weeks, and five team members. Its case is shared libraries, where a support team needs the same forty replies with the same wording, and one person editing a snippet updates it for everyone.
Keyboard Maestro sits in the key-binding half rather than the expansion half. Version 11 is current, the site states that it requires macOS 10.13 High Sierra or later, and the licence is a one-time purchase rather than a subscription.
Alfred and Raycast both include snippets alongside their launcher features. Raycast's free plan lists snippets among its core features, which means text expansion arrives as a side effect of installing a launcher rather than as a separate purchase.
When the combination is already taken
Key bindings on macOS resolve in a fixed order, and understanding that order turns most mysteries into a two minute fix. The frontmost application gets the keystroke first. If it does not handle the combination, the system's own bindings get a look. Anything registered globally by a background utility sits above both and can swallow the key before the application ever sees it.
The practical consequence is that a combination that works in the Finder and fails in one specific application is being consumed by that application, and a combination that fails everywhere is being consumed by something global. Those are different problems with different fixes: rename the binding in one case, find the background utility in the other.
Choosing combinations that are unlikely to collide is cheaper than diagnosing collisions later. Three-modifier combinations are rarely claimed by applications, which is why Control-Option-Command plus a letter is the conventional place to put personal bindings. Single-modifier combinations with Command are almost all taken. The function row is safe on paper and awkward in practice on keyboards where those keys carry brightness and volume duties by default.
One more habit saves time: keep a written list of every custom binding. Six months later, a combination that does something unexpected is indistinguishable from a broken Mac unless there is a record of what was assigned and why.
Where all of this collides: the browser
Every mechanism above assumes the keystroke reaches the system. Inside a browser, that assumption weakens. A web based editor intercepts keystrokes in JavaScript, and a web app that implements its own text handling can consume a trigger before the system's replacement engine sees it, or accept the replacement but place the cursor somewhere unexpected.
Key bindings have the sharper version of the problem. Command-K inserts a link in one web app, opens a command palette in a second and jumps to a channel in a third. The browser adds its own layer on top, and an assigned App Shortcut competes with all of it. The result is a combination that works in one tab and does nothing in the next, with no error and no explanation.
Two things reduce this. The first is preferring native text fields for the replacements that matter most, which is why an email client on the Mac behaves more predictably than the same account in a browser tab. The second is reducing how many web apps share a single window, since a browser that keeps each web app in its own window means the app in front is the only one competing for the key. Where the same service is used under several accounts, scoping each one to its own workspace keeps the bindings predictable per window rather than per tab.
Anyone already scripting this kind of thing will find the built-in terminal route more direct, since a shortcut invoked with shortcuts run sidesteps the keystroke question entirely and takes its input from the command instead.
What to change first
Start with Text Replacements for every string that never changes, since it costs nothing and syncs to the iPhone already in the room. Add App Shortcuts for the two or three menu commands reached most often, and only then look at a paid tool, once it is clear whether the missing piece is dynamic content or shared libraries. If the triggers keep failing inside browser tabs rather than native apps, the problem is window and account layout, which is the part SpaceDeck is built to fix.
Frequently asked questions
Why does a text replacement work in Notes but not in a web based editor?
Apple's documentation states directly that "Text replacements, smart quotes and dashes, and smart links aren't available in all apps." Web based editors handle typed characters in JavaScript, so a trigger can be consumed before the system's replacement engine ever sees it. The only reliable test is trying the trigger in the specific app where it is needed.
Can a keyboard shortcut be assigned to a menu item that has none?
Yes. In System Settings, go to Keyboard, then Keyboard Shortcuts, then App Shortcuts, click Add, and enter both the exact menu item name and the key combination. The name must match the menu exactly, including capitalisation and any trailing ellipsis, which is the usual reason a new binding appears to do nothing.
Do text replacements created on a Mac also work on an iPhone?
Text replacements are designed to stay current across Apple devices signed in to the same account, so a trigger created on the Mac is intended to be available elsewhere. Apple's guide points to a separate section on backing up and sharing them, so the behaviour is worth confirming on the specific devices in use rather than assumed.
Is a paid tool needed to insert today's date automatically?
No. A macOS Shortcut can build text from the current date, the clipboard or the selection and then paste the result, which covers dynamic content without a subscription. Paid tools become worth the cost when the requirement is a shared snippet library across a team, or macros that trigger on events rather than only on keys.
What is the difference between Text Replacements and a snippet tool like Espanso?
Text Replacements is built into macOS, costs nothing, syncs across Apple devices and inserts a fixed string. Espanso is free and open source under the GPL-3.0 licence, runs on Windows, macOS and Linux, and supports larger libraries and more complex triggers. The trade is portability and power against having nothing extra installed.