Running a command in a new Mac OS X Terminal window

We’ve been trying to figure out how to open multiple terminals on OSX and running different bash commands in each. 

Most examples online show how to open a terminal or how to run a command in a home directory but in our Node app, we wanted to open two terminals in the current directory and execute two different npm run scripts

So what we did was

  1. Create a  file in the root directory of the app called – start.sh
  2. Edit start.sh to add two apple scripts that will open two terminals and execute two different commands
  3. Open your editor terminal and run
     sh start.sh

CZ Consultants

As we are helping startups and enterprises deliver robust, scalable, secure and quality projects quicker than anyone else, we learn a few tricks along the way from engineers world wide.

Share the ❤️