Automatically open a terminal window and run a command, robustly I am looking for a way to automatically open a new window of Terminal.app and run a command in it.

I used to do this with AppleScript, in a way similar to this:

tell application "Terminal"
  do script ("some-command")
end tell


The official distribution of Julia opens terminal windows in the same way.

However, if Terminal.app is set up to run a command on startup (which is an often recommended practical way to set a new shell without changing the login shell globally), this method simply fails.

Is there a robust method that works even when an alternative shell is used?
Save whatever script you wish to a file and when you change the extension to .command 

Finder will robustly make a command line window that’s new to run that command / script. This works for whatever #!/bin/whatever shell or script you start the text file. 

AppleScript can open documents just like when Finder clicks on them to open, this should be a fairly universal way to accomplish your task.