Someone on the MacAdmins Slack recently asked how you could assign a global keyboard short cut to open Terminal on macOS.
Note: alternative terminal applications such as iTerm2 may have this built-in.
macOS has an option to assign custom global keystrokes to pretty much anything, but it is not obvious how to get there.
- First, open the Automator application. In the chooser for a new Workflow, choose ‘Quick Action’ (on Mojave) or ‘Service’ on earlier versions of macOS.
- In the new workflow configure the input to be ‘no input’ and the application to be ‘any application.’
- Then search for ‘Launch Application’ action in the library pane on the left and add it to your workflow by double-clicking or dragging.
- The popup menu where you can slect an application in the action will only show applications from the
/Applicationsfolder. Choose ‘Other…’ and select Terminal in the ’/Applications/Utilities` folder.
- Save the workflow. Give it a meaningful name such as ‘Open Terminal.’ Since you chose Quick Action or Service, this workflow will be saved in
- Open System Preferences > Keyboard. Click the ‘Shortcuts’ tab and select ‘Services’ from the list on the left side. (Even on Mojave, it is still called ‘Services’.)
- Scroll all the way down the list of services under the ‘General’ heading, you should find the service you just created. Select it and click ‘Add Shortcut’ to assign a global shortcut.
- You are done!
When the active application uses the same keystroke, the application’s definition will precede your global shortcut.
Of course, you don’t have stop at launching applications. You can assign a global keyboard shortcut to any Automator workflow this way. Since Automator workflows can include AppleScript, Python or shell scripts, you can do pretty much anything this way!
However, most Apple users don’t bother with shortcuts to launch apps. Just invoke Spotlight with command-space and start typing
term and hit return.
7 thoughts on “Open Apps with custom Shortcuts in macOS”
is there anyway to assign these shortcut keys using shellscript? I have workflow files used for various 3rd party apps. I need to assign shortcut keys for these workflows. can we do it via script or any other APIs?
Currently we need to manually go and set it.
As far as I can tell, the settings are stored in
~/Library/Preferences/pbs.plistNot sure if that is the only place, though.
I’ve tried doing this in Catalina and it doesn’t seem to work. Should one do anything different in that version of macOS?
It still works for me…
Very inconsistent results for me in Catalina 10.15.4 – shortcut works immediately in some apps but takes many attempts in others. Once working in an app it continues to work until that app is closed. Strange!
Is this a known bug? Makes the whole concept useless.
Your proposed solution didn’t work for me as well. After some research, I’ve found this thread
https://discussions.apple.com/thread/5048120 and the answer by skouba. Thank you so much.
Long story told short: After running the script via “Finder –> Services –> ” the keyboard shortcut started working.
Interesting, but my problem is with Adobe InDesign, which doesn’t have a Services menu item!
Comments are closed.