Last Updated: February 25, 2016
·
1.049K
· helmedeiros

JavaScript in v8 at macOS terminal

Sometimes we need to run our script JS directly from our preferred IDE, even after many of them have evolved their integration with major browsers, there are still those who prefer something more root.

To run JavaScript via Google's V8 Javascript engine, directly from you MacOSX terminal, you'll need to:

  1. Install Homebrew first:

    $ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

    $ which brew

    /usr/local/bin/brew

  2. Install the V8 engine:

    $ brew install v8

  3. Start the V8 console, just run v8!

    $ v8 /Users/helmed/cajs/whileLoops/Project/16-whatYoullBuild.js

Tip: To close the terminal, just type quit() and press enter!