Last Updated on 2021-10-10 by Clay
After I move my workspace environment from Linux to Mac OS, I'm not used to have no any shortcut key to open terminal(Terminal.app).
Fortunately, after searching on the Internet, I found the configuration method and I recorded it here.
Configure shortcut keys
To set the shortcut key to "open terminal", you need to do the two steps:
- Write the command "open terminal" as AppleScript (Apple-specific script)
- Set AppleScript as shortcut
Step 1. Build a AppleScript
Open Finder > Applications > search automator > open Automator.

Select Quick Action.

Searching as left side, find Run AppleScript, drap it to the right side, and we can start to write our command.

Write:
on run {input, parameters}
tell application "Terminal"
do script
activate
end tell
end run
Select execute key(arrow shape), and execute it can open terminal or not.

After confirming that it can be executed, use command + s to save. I named it Open Terminal. You can open the Finder to search for the existence of this file.
Found it and double-click to execute and install. You can confirm whether there is a .workflow file with this file under Library/Services.
Step 2. Set a shortcut key
Open System Preferences > Keyboard.

Select Shortcuts > Services > set Open Terminal shortcut key.

I select a shortcut keys that is similar to the Linux shortcut keys: control + command + t.
If you need to be able to use it anywhere, add App Shortcuts.

After that, you should be able to call the terminal according to the shortcut keys we set.
References
- https://claudiodangelis.com/osx/2012/09/27/osx-launch-terminal-from-shortcut.html
- https://apple.stackexchange.com/questions/175215/how-do-i-assign-a-keyboard-shortcut-to-an-applescript-i-wrote