Last Updated: February 25, 2016
·
1.358K
· 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!

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside