How do I get a Javascript runtime interpreter installed on OS X?

javascript, macos, terminal

Solution

Node.js. It's the V8 engine + libraries + REPL.

Although Node is usually used for web/network-related applications, at its core it's just a plain JS engine and can even be used for shell scripting.

You can install it from the installer, `brew` or just `./configure && make` from a Node.js' tarball.

There's also Rhino.

Problem

With OS X Xcode installed one can run ruby code in terminal with ">ruby somefile.rb" command (or from inside TextWrangler with the run command). You can also run a ruby interpreter from in terminal and type code in single lines while the interpreter retains variable objects. Want same possibilities for Javascript. What must I install (if anything) on OS X to have that functionality? Not looking for an IDE as such just an interpreter that will run in Terminal.app? I assume this is an allowed question for Stackoverflow based on other allowed questions about IDEs for various languages like: What's a good IDE for Python on Mac OS X?

Original source

Related problems