Getting a javascript command line; using homebrew to get v8
By Alex Kessinger on
Find me on: Google+, Twitter, and email
In writing my book I am constantly wanting to play with javascript to make sure my examples are correct. Or if I just want to figure out how and idea will work. I have been just opening up the console in firefox, and chrome to test these ideas out, but I thought wouldn’t it be cool if I could just use an interactive command line like python has.
Well, I guess I new this would workout somehow, but I had no idea how easy it would be. v8 comes in nice command line package, you can download, and compile it your self if you want, but if you have a mac it’s even easier.
I have started using the homebrew for my OSX package management. Fink, and MacPorts are still around, but they seem to big, and always broken for me. After installing homebrew with their fancy one line installer.
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
Then installing XCode from Apple you are ready to install all those new fancy open source projects, like v8. After I installed everything I was able to see if they had a recipe for v8.
brew search v8
and they did it was called v8, duh. Then I was able to install it
brew install v8
And it went to town, after it was done all I had to do was type v8 and I was presented with this.
V8 version 2.3.5.3 >
Tada.
Now I am just trying to figure out how you load in modules, and if that is even possible.