I am new to Mac OS (I am currently using Mavericks) and I have performed google searches as well as search on StackExchange regarding my question but the discussions I came across don't quite answer my question.

I come from the linux world and it is trivial for me to set a custom command in the gnome-panel and then put in any argument I like; many of these commands invoke xterm.

So for example, suppose I want to create a launcher to connect to a remote server with lot of arguments as below.

xterm -fg orange -bg black -e ssh me@myserver

I cam across a post that suggested I use the automator. I am however unable to do this successfully.

So far in the automator, I have

open -a "/opt/X11/bin/xterm" --args "-fg orange -bg black -e ssh me@myserver"

however this command does not execute properly and I am not sure how to solve this problem.

Thanks Les p.s. Note that if I launch the Terminal and type in xterm, it launches as expected

  • Why not use the built in terminal? It's really highly customizable, and you can make it emulate x-term. Terminal brings a lot of advantages like full screen mode, copy/paste with + c and + v. It also let's you build your own custom profiles, allowing for custom fonts, transparency, and even default commands ran on start (such as to start an SSH session).
    – Alexander
    Commented Dec 27, 2013 at 16:59

2 Answers 2


You can write it as a shell script within the Run Shell Script action in Automator:


Save it with the type Application (instead of Workflow) and place it in your Applications folder. It can now be placed in the Dock.

  • 3
    Any idea how I can change the icon for this executable?
    – Lee Sande
    Commented Dec 27, 2013 at 15:09
  • 1
    You can change the icon of pretty much any volume/folder/file by pressing + i, and pasting any image file into the image well in the top left corner
    – Alexander
    Commented Dec 27, 2013 at 16:59
  • Thank you for the response. I did apple + i and then I drag and dropped the image (a png file); however the icon changes to a generic "PNG" file mime type icon not the actual image. Do I need to have a specific file format for icons? I also followd the steps here (365icon.com/icon-styles/dock-icons/how-to-change-mac-dock-icons) but even after pasting the new image (after selecting the icon on the upper left), the new image does not show up (after restart of the program).
    – Lee Sande
    Commented Dec 27, 2013 at 18:57
  • 3
    Ooops, I should have better clarified: You need to paste the image itself, not the image file. The quickest way I can think of to do this is to double click an image file (to open it in Preview.app), press + a, copy the selection and paste it into the image well
    – Alexander
    Commented Dec 27, 2013 at 22:46
  • 1
    I can't rate up because I don't have sufficient reputation to do so. Sorry.
    – Lee Sande
    Commented Dec 29, 2013 at 1:31

Automator and AppleScript are the best ways at creating custom scripts/apps that perform commands as you described. Each have their pros and cons. For most tasks I prefer to write AppleScripts, probably because I'm a programmer myself and because they are easy to access and edit.

To write AppleScripts, you can use the OS X provided program called "AppleScript Editor." AppleScript editor allows you to write your AppleScripts and save them as an actual AppleScript with a file extension of .scpt or as an Application (.app) which can be run from anywhere.

If you save your AppleScript in the AppleScript format (.scpt), and with the help of a application called FastScripts (also available in the Mac App Store), all your personal scripts and system scripts can be made easily accessible in the menubar. And Fast Scripts provides the extra benefit of allowing you to assign keyboard shortcuts to them. You can do the same with Automator workflows, I just find it's easier to do with AppleScripts and FastScripts.

Here is a sample AppleScript I created that I have previously shared on the boards that toggles the visibility of hidden files in OS X. This is one of my more basic scripts which is I why I am showing it as an example of how simple it is to write an AppleScript. With the help of FastScripts, I set a keyboard shortcut of ^ + + + . to activate this script.

tell application "System Events"

    set hiddenFilesDisplayStatus to do shell script "defaults read com.apple.finder AppleShowAllFiles"
    set hiddenFilesNewDisplayStatus to "NO"

    if hiddenFilesDisplayStatus is "NO" then
        set hiddenFilesNewDisplayStatus to "YES"
    end if

    do shell script "defaults write com.apple.finder AppleShowAllFiles " & hiddenFilesNewDisplayStatus
    do shell script "killall Finder"

end tell

I have a variety of other AppleScripts that perform various tasks, so if I were you, look at AppleScripts first, then look at using Automator. There are many resources out there for helping you create AppleScripts, and you'll find that there are many others that have already written AppleScripts that may already do what you are looking for.

To answer your specific use case

Try creating an AppleScript with the following command, notice the fully qualified path to xterm. On my machine it was different than yours. It's important to note that I have XQuartz installed on my machine since Mavericks does not come shipped with X11 any longer.

do shell script "/usr/X11/bin/xterm -fg orange -bg black -e ssh me@myserver"

I tried the above command, pointed to my server and it worked fine. What would be really cool if you got this working with this AppleScript is that you could even set up the AppleScript to ask for input for the username and server you with to connect to, and it'll set that in the shell script command for you and if nothing is provided, you could have it default to a particular username/server. :)

FYI, I figured out the pathing issue to xterm using this SO article: https://stackoverflow.com/questions/11206872/open-xterm-telnet-connection-mac-os-x

  • Thank you for your answer and the link to the path problem in xterm.
    – Lee Sande
    Commented Dec 27, 2013 at 14:55

You must log in to answer this question.

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