Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Linux has a command x-terminal-emulator that will activate a new terminal emulator. And i believe it works with the set default emulator.

  1. Does OS X have a similar command or the same command?
  2. Do all Mac OS X versions have this option?

My intention is to have a bash script launch a new bash script in a new terminal window.

I do not have a Mac to test this right now.

share|improve this question

The x-terminal-emulator does not exist in OS X. It would rely on an alternatives system, which simply doesn't work that way on OS X. Instead, it defines default applications for certain MIME types, URI schemes, or file types. Simply put, that is.

The easiest and most portable way to launch a new window from within a shell is to run the following AppleScript command:

osascript -e 'tell app "Terminal" to do script ""'

If you additionally require focus on this new terminal window, run after that:

osascript -e 'tell app "Terminal" to activate'

To run a shell script from within that window, simply give do script the path to the shell script:

osascript -e 'tell app "Terminal" to do script "/path/to/"'

Again, if you require focus after that, run the second activate command from above.

Some users of OS X might have iTerm2 installed as a replacement for the default that ships with OS X. While it doesn't register as "default" terminal—in general there's no such notion of a "default terminal" in OS X—some users might choose to use it for certain URL schemes. See: Setting iTerm2 as the default terminal (OSX Lion)

Otherwise, there is no "preference" setting for users to choose iTerm2 over If you want to use iTerm2 instead of, you can check out the following answer. iTerm2 doesn't accept do shell script and requires you to write text to its prompt.

share|improve this answer

You must log in to answer this question.

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