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
- Create a file in the root directory of the app called – start.sh
- Add the following lines in start.sh file to start a terminal and run a command
ttab eval 'cd "/Users/You/Documents/WWW/myapp"; nodemon app.js' ttab eval 'cd "/Users/You/Documents/WWW/myapp"; gulp'
- Open the terminal and cd to the path of start.sh and run
Did that work for you?