I've managed to open the terminal in the right folder using AppleScript. but I can't figure out how to make it run node index.

How the line of code looks so far:

do shell script "open -a 'Terminal' ~/Competitor\\ Monitoring/Magic"

The idea is to package it as a program and run it daily through a calendar action.

New contributor
Thomas Cilius Hansen is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

1 Answer 1


You may have the cart before the horse here (or even two carts if you really want launchd or cron to schedule your process to run).

I would save your command to a script file and test it with your chosen shell (zsh recommended) and when it works manually, rename it to file.command and then open the file directly

open ~/Competitor\ Monitoring/Magic/run_node.command

Here is a bash example on letting the script check your directory if you don’t want to hard code them. It’s simpler to put everything in the same folder, though and then you don’t need any of the checking of path at all or passing the path to the script or command to the application after it launches.

Your script might be as simple as:

#!/usr/bin/env zsh

node index
  • 1
    If you want to go to extremes, the script might be as simple as #!/usr/local/bin/node index (one line only) :-)
    – nohillside
    May 11 at 15:15
  • I debated how much to include @nohillside that’s an excellent point. If figured learning env was useful to have in the most minimal script especially if paths are foreign
    – bmike
    May 11 at 17:00

You must log in to answer this question.

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