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

I am trying to open a new terminal window in mac and execute a node command via ant

   <exec osfamily="unix" dir="${dir}" executable="open" failonerror="true">
            <env key="MONGODB_HOST" value="${}"/>
            <env key="MONGODB_DATABASE" value="${mongo.dbname}"/>
            <arg line="-a Terminal ."/>
   <exec osfamily="unix" dir="${dir}" executable="node" failonerror="true">
            <arg line="${}.js "/>

However the second exec executes within the old terminal window and not the new one that is opened by the first exec

Can anyone please guide me as to how I can execute the second exec within the context of the new terminal window

I am trying to emulate the basic functionality of

  • opening a new terminal window

  • setting environment variables

  • and executing node server.js

via the ant command on a mac

share|improve this question

i was finally able to do it using the following shell scripts and calling them from ant :)

osascript -e "tell application \"Terminal\" to do script \"cd $pwd; clear\"" > /dev/null



osascript -e "tell application \"Terminal\"" \
    -e "tell application \"System Events\" to keystroke \"t\" using {command down}" \
    -e "do script \"cd $pwd; clear\" in front window" \
    -e "end tell"
    > /dev/null
share|improve this answer

You must log in to answer this question.

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