Macros are used to automate your workflow, procedure, or process on your Mac. Macros, also known as Shortcuts, are a way of improving your productivity by allowing you to perform repetitive or frequently required actions more quickly and accurately, tailoring your Mac to your usage patterns.
A Macro consists of:
Macros are contained in Macro Groups, much like files are contained in folders. The Macro Group determines when the Macro is Active (available to be triggered). Macro Groups control such things as which applications the Macro will be active in.
A simple example of a Macro is one which has:
Macros can do almost anything you can do manually on your Mac, and much that you can't, like running scripts.
To create a Macro, first launch Keyboard Maestro, select the desired Macro Group to contain it, and then click the + button below the Macros list. To edit a Macro, double click it, or select it and ensure the Edit button is pressed. The Macro Editor window will be displayed.
Enter the name of your new Macro (you can skip this and it will be named for you based on the action you select).
You can create a new trigger by clicking on the green ⊕ button. There are several Macro Triggers to choose from, the most common being the Hot Key trigger which allows you to execute the Macro at the press of a key. You can define several different triggers, and any of the triggers will execute the Macro Actions. You can delete a trigger by clicking the red ⊖ button.
You can add a new action by clicking the New Action button or the + button at the bottom of the macro detail view to display the list of actions or by choosing the Edit ➤ Insert Action By Name menu or choosing from the Edit ➤ Insert Action menu. There are many Macro Actions to choose from. The actions you include will be executed in order. You can reorder the actions by dragging them around. You can copy actions by Option-Dragging or by using Copy and Paste. You can delete an action by selecting it and pressing the Delete key. You can enable or disable actions by selecting them and clicking the ✓ button at the bottom of the macro detail view.
You can control or right click on a macro group to Disable, Enable, Rename, Duplicate, or Export it.
An easy way to generate macro actions is to turn on recording by clicking the Record button at the bottom of the macro detail view and proceeding to show Keyboard Maestro what you want to do. Then turn recording back off and look through the actions. Chances are you will need to delete or adjust some of the recorded actions to make a robust macro, but this will be quicker than creating each action manually.
Macros are continuously saved, so the macro is live as soon as it is created. It will be available immediately (subject to the restrictions of the Macro Group it is contained in). There is no need to turn off editing, switch to a different macro, or quit the editor (although quitting the editor after you have finished editing all your macros is a good idea).
You can select a recently triggered macro by clicking on the ⌘ toolbar button to select it or select from recently modified macros by clicking the ◷ toolbar button.
You can share a macro to the Keyboard Maestro Forum, or to a friend via Mail or Messages using the sharing button at the top of the Macros window.
You can disable or enable a macro by selecting it and clicking the ✓ button at the bottom of the Macros list. You can also disable or enable a Macro using the Set Macro Enable action, or from AppleScript with:
tell application "Keyboard Maestro" set enabled of macro group "Macro Name" to true end tell
You can start editing a Macro from AppleScript with:
tell application "Keyboard Maestro" editMacro "Macro Name or UID" end tell
The Keyboard Maestro editor has full AppleScript support so you can manipulate macros in many ways via AppleScript.
You edit a macro by selecting it and ensure you are in Edit mode. Double clicking on the macro will turn on Edit mode.
You can select a macro by name by choosing the View ➤ Select Macro By Name menu.
In order to run (execute or trigger) a macro it must be active, that is:
Activation/Deactivation or a Macro Group is a dynamic process, automatically set by the Keyboard Maestro Engine as your Mac's environment changes in real time. For details, see Macro Activation
You can try out a macro from the Keyboard Maestro by clicking the ▶︎ Run button at the top of the editor window. Of course, macros are often sensitive to the context, so it may not be appropriate to run them directly from the editor.
Generally, you run a macro by invoking any one of its triggers.
You execute a macro’s action sequence by invoking one of its Macro Triggers that you have defined (such as pressing a hot key if you have configured a hot key trigger). For some triggers, no action is required on your part. For example, the macro could be triggered at a specific time, or when a specific USB device is attached.
You can also trigger macros by name using the Trigger Macro by Name action, which in turn can be in a macro and triggered any way you desire.
You can trigger a macro using the kmtrigger: scheme with a URL like
kmtrigger://macro=MacroName&value=Value (the value is accessible via the %TriggerValue% Text Token).
If the web server is enabled for remote access, you can trigger a macro remotely after logging in using a web browser or the Keyboard Maestro Control iPhone application. Alternatively, you can use the Remote trigger and trigger your macro using a URL from remotely via our trigger server.
You can also trigger a macro using AppleScript or another scripting language (select the “Or by script” entry to display script code in various languages such as AppleScript or Perl).
Note that the web server needs to be separately enabled in the Web Server preference pane, and all macros are subject to the restrictions of the Macro Group they are contained in. If the Macro Group is not enabled and active, the macro will not be available.
You may want to import Macro(s) you have downloaded from other sources, like the Keyboard Maestro Forum.
You may use any of the following to import the macro file (
Note that the macro file (
.kmmacros) may contain one or more macros, and will also create the Macro Group if it does not exist in your configuration. Otherwise, it will put the Macro in your existing Macro Group.
⚠️ You should be aware that the macros will be imported in the same state, triggers, and macro group that they were saved in. By default, macros are imported disabled unless you hold the Option key down. Importing them disabled is important, because otherwise this could result in the imported Macro being triggered (executed) as soon as it is imported. If you are at all uncertain about the source of the macros, ensure you import the macros disabled or choose the File ➤ Import Macros Safe menu.