i looking answer question on stackoverflow , found thread (https://superuser.com/questions/229773/run-command-on-startup-login-mac-os-x). that's how found out launchd.plist , made 1 myself:
<?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple computer//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>label</key> <string>js.leapmotion</string> <key>ondemand</key> <false/> <key>programarguments</key> <array> <string>open</string> <string>/applications/utilities/terminal.app</string> </array> <key>launchonlyonce</key> <true/> </dict> </plist>
this indeed starts terminal after booting mac. want navigate directory , run command gulp
in there. again rest, opens localhost , on...
so in end need run gulp
within specific directory. that's all. if launchd.plist not best way go, i'm open alternatives. otherwise know how can tell terminal commands should run.
thanks hints. cheers
j
you can use open
command open terminal , run script using -a
flag. example, open -a terminal /path/to/myscript
open new terminal window , run myscript
. note when myscript
finishes, session terminate (i.e. there's no shell). change that, can run bash
or whatever preferred shell part of script.
in case, suggest creating basic script whatever want terminal execute, such :
#!/usr/bin/env bash cd /path/to/your/directory /usr/bin/gulp
save (making sure it's executable), , change launchd plist match:
<key>programarguments</key> <array> <string>open</string> <string>-a</string> <string>terminal</string> <string>/path/to/yourscript</string> </array>