This is how you can enable JSC:
at the top of a shell script. JSC Wiki lists some extra commands you can use in your CLI scripts.
Alternative JS CLIs
If you install Homebrew, “the missing package-manager for OS X” (generally a great idea for a developer), installing Google v8 or Mozzila Spidermonkey or Rhino becomes trivially easy:
$ brew install v8 $ brew install spidermonkey $ brew install rhino
For Rhino, you need to make sure you have Java installed on your Mac. If you do that, JS executables will correspondingly be located in:
/usr/local/Cellar/v8/HEAD/bin/v8 /usr/local/Cellar/spidermonkey/1.8.5/bin/js /usr/local/Cellar/rhino/1.7R3/bin/rhino
Typically, brew will also create convenience symlinks:
/usr/local/bin/v8 /usr/local/bin/js /usr/local/bin/rhino
For quick shell-script prototyping, Spidermonkey is my favorite because you can put:
at the top of a shell script, making it executable, and Spidermonkey is much more debuggable than JSC (which swallows error messages).
Pretty neat stuff, overall.