Skip to content

[MacOS] Create a Shortcut to Open Terminal

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.

system preferences

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


Read More

Leave a Reply