I have set 'always open with' to : 'Iterm2', for .sh files in osX.
Although a double click on a shell script now opens a new Iterm window, the script does not actually run, I just the get the empty prompt. There might be an applescript solution, but I would prefer a more direct way.

1 Answer 1


It works for me but only if the file is executable. For example this runs a.sh in a new window:

echo say a>a.sh;chmod +x a.sh;open a.sh -a iTerm

If you want it to work with non-executable files, set an application like this as the default application for .sh files:

  • Thanks, I followed your instructions, even though my .sh files are already executable. Unfortunately : same result, it does open the iTerm window but just an empty prompt again! It seems that iTerm does not listen to the argument, but I can't find any relevant setting inside iTerm. Are you using Iterm2 ?
    – msarch
    Commented Jan 15, 2014 at 21:17

You must log in to answer this question.

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