MacOS – How should I start a new iTerm terminal with shortcut

automatoritermkeyboardmacos

I've created a service in automator and assigned a shortcut, and it works.

enter image description here

But this doesn't start a new iTerm terminal. It only reveals the already running one

How can I start a new "tab" or a new "iTerm window"?

Best Answer

You can change the Action in your Automator-defined service to an AppleScript action:

  • Select Library/Run AppleScript in the Actions window
  • Add the following AppleScript in the created Action and save:
if application "iTerm" is not running then
    activate application "iTerm"
else
    tell application "iTerm"
        create window with default profile
        activate
    end tell
end if

This opens iTerm if it is not running, else it opens a new window. See iTerm documentation for more examples of AppleScript scripting for iTerm.