I'm trying to find out if there is a way of creating a shortcut to the following terminal command - so that I can have it on my Dock (Big Sur)

ssh [email protected]
  • So the Icon should open Terminal and run the command?
    – nohillside
    Apr 30, 2021 at 15:35
  • Hi, yes that's correct Apr 30, 2021 at 16:30

2 Answers 2


In Automator, create a new Application.

In that application, add an action "Run AppleScript" For the content of that AppleScript,

tell application "Terminal"
        do script "ssh [email protected]"
    end tell

Save the application, then in the Finder, drag the new application to the Dock

  • 1
    do script "exec ssh ... to avoid having to quit an additional shell layer.
    – nohillside
    Apr 30, 2021 at 18:55
  • if he's ssh-ing in somewhere, I figured he wants to be left in the shell layer, no?
    – Daniel
    Apr 30, 2021 at 19:08
  • 1
    I would just use Script Editor and save the code as an application, It may be six of one, half a dozen of the other, however, in a use case such as this I believe Automator will actual use more resources to accomplish the same task. Apr 30, 2021 at 21:30
  • 'doh! Yes, Script Editor would work great. For many contexts, Automator adds functionality of where the script can run; in this case, Script Editor on its own would be absolutely fine.
    – Daniel
    May 1, 2021 at 3:50
  1. Create a new plain text file containing the command you want to run.
  2. Name the file with extension .command.
  3. Save the file somewhere.
  4. Set the execute bit on the file with chmod +x /path/to/file.command.
  5. Drag the file to the Dock, right of the right separator.
  6. Opening the file will launch Terminal and run the command.
  • Two critical issues with this answer as it's currently written using the shell command shown in the OP: 1. Upon clicking on it in the Dock one would get, e.g.: "The file “name.command” could not be executed because you do not have appropriate access privileges." (You need to make the .command file executable, e.g. chmod u+x /path/to/name.command in Terminal) 2. However, once made executable and clicking on it in the Dock, one would end up with, e.g.: % /path/to/name.command ; exit; and the Terminal window would just not usable. Apr 30, 2021 at 22:03
  • @user Thanks for the point about chmod I forgot about that, will edit that in. Using the Terminal window created after the command is run wasn’t specified in the question.
    – grg
    Apr 30, 2021 at 22:05
  • 1
    RE: "Using the Terminal window created after the command is run wasn’t specified in the question." -- The shell command in the OP is ssh [email protected] and obviously one needs an interactive window with it, otherwise it's useless! Apr 30, 2021 at 22:08
  • +1. This won't work for the asker's very specific circumstance, but answers are supposed to be broadly applicable. You might consider adding a note about the terminal window staying open vs closing. May 19, 2021 at 1:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .