Home > News Tips

How to Create a Shortcut for Terminal Command on Mac

Updated on Wednesday, April 30, 2025

iBoysoft author Yvonne Feng

Written by

Yvonne Feng
Professional tech editor

Approved by

Jessica Shee

English Français Deutsch やまと Español Português Türkçe

Summary: How do I create a shortcut to run a command? Read to know the detailed steps to create a shortcut for Terminal command on Mac using Shortcuts app, Automator, and shell scripts.

summary-create-shortcut-for-terminal-command-mac

I need to run multiple Trader Workstation instances using open-n in Terminal, but want a simpler way, like a clickable shortcut or keyboard trigger—ideally with Mac's Shortcuts app. - Reddit

If you often run specific commands in the Terminal on your Mac, such as launching an app, mounting a drive, or executing a script, you might want a faster way to do it instead of typing the command manually every time.

You can create a shortcut to run these commands with a single click. This guide will show you how to create a shortcut for Terminal commands on your Mac, using built-in tools like the Shortcuts app, Automator, and shell scripts.

Method 1: Use the shortcuts app (macOS Monterey and later)

The Shortcuts app on macOS supports the “Run Shell Script” action, allowing you to run complex Terminal commands without manually typing them each time. Instead, you can execute them quickly via an icon, the Dock, or a keyboard shortcut.

Before you begin, make sure the Shortcuts app is installed on your Mac (it comes pre-installed on macOS Monterey and later).

Follow these steps to create a shortcut for a Terminal command:

  1. Open the Shortcuts app. You can find it in the Applications folder or launch it using Spotlight (press ⌘ + Space and type "Shortcuts").
  2. Click the "+" button in the top-left corner to create a new shortcut. Give it a name, such as “Launch Trader Workstation.”
  3. In the right-hand search bar, search for and add the “Run Shell Script” action.
  4. In the “Run Shell Script” input box, enter the command you want to execute. For example, to open multiple instances of Trader Workstation, use:open -n /Applications/Trader\ Workstation.app Make sure the path matches the actual location of the app on your system.
  5. Click the settings icon in the top-right corner to customize the name and icon for your shortcut.
  6. To add the shortcut to your desktop or Dock, click the “File” menu in the top-left and choose “Add to Dock,” or drag the shortcut from the Shortcuts app into the Desktop via Finder.

Once set up, you can launch the command with a single click or assign a keyboard shortcut for quick access—making it easy to open multiple app instances without using Terminal.

Share the method with more people to guide them on how to create a shortcut for Terminal command on Mac using by Shortcuts app!

 

Method 2: Create a shell script and save it as an app

macOS allows you to execute shell scripts from the GUI by wrapping them in an Automator-generated .app. This way, you can double-click an icon like any other app to trigger complex terminal commands behind the scenes. 
Here is how to do it.

  1. Open TextEdit, then click Format > Make Plain Text.
  2. Type your command in a Bash script, for example:#!/bin/bash 
    open -n /Applications/Trader\ Workstation.app
  3. Save it as launch_trader.sh to your Desktop.
     save-it-as-launch-trader-sh-desktop
  4. Open Terminal and type the following command to make the script executable.chmod +x ~/Desktop/launch_trader.sh
  5. Open Automator, and choose Application as the document type.
  6. In the left search bar, type “Run Shell Script” and drag it into the workflow.
  7. In the script box, enter:~/Desktop/launch_trader.sh
  8. Go to File > Save, name it like Launch Trader App, and save it to your Desktop or Applications folder.

You can add it to your Dock or assign a keyboard shortcut via Shortcuts or third-party tools like Raycast or Alfred. Now, every time you double-click that .app, it executes your Terminal command.

Method 3: Use Automator service with a keyboard shortcut

Automator Services (now called “Quick Actions”) can be triggered by keyboard shortcuts and are deeply integrated into macOS. This lets you run terminal commands anywhere, even when other apps are in focus.

How to do it:

  1. Open Automator, and choose Quick Action (or “Service” in older macOS versions). 
  2. At the top, set: “Workflow receives” → no input, “In” → any application.
     set-workflow-receives-no-input-In-any-application
  3. Search for “Run Shell Script” in the left panel and drag it to the workflow. 
  4. Enter your terminal command. For example, you can type the following command if you want to open multiple instances of Trader Workstation. open -n /Applications/Trader\ Workstation.app 
  5. Save the Quick Action with a name like Launch Trader.
     save-the-quick-action
  6. Go to System Settings > Keyboard > Keyboard Shortcuts > Services.
  7. Find your Launch Trader service and assign a keyboard shortcut like ⌘ + Shift + T.

Now, pressing that shortcut will run your Terminal command from anywhere on macOS.

Share the above three useful methods to help more people!