Skip to content

Installing PhantomJS and CasperJS

Hannah Wolfe edited this page Aug 12, 2013 · 3 revisions

Mac

This is super-duper simple using brew

Phantomjs:

brew update && brew install phantomjs

Casperjs:

Note: Use --devel to get v1.1 which we require

brew install casperjs --devel

###Linux / Vagrant box

Phantomjs:

Use wget to fetch the correct archive from http://phantomjs.org/download.html:

E.g. for 64-bit (find out which architecture you're on with arch)

Casperjs:

Git method is recommended. Doesn't matter where you clone casper.

  • $ git clone git://github.com/n1k0/casperjs.git
  • $ cd casperjs
  • $ ln -sf pwd/bin/casperjs /usr/local/bin/casperjs (may require sudo)

Windows

As always, Windows is a little tricky

Phantomjs:

  1. Download the zip from phantomjs: http://phantomjs.org/download.html
  2. Unzip it to a safe/sensible location. I would recommend C:\phantomjs
  3. Add ;C:\phantomjs\bin (or the correct path if you unzipped somewhere different) to the end of your PATH environment variable (the System one). If you're not familiar with finding your environment variables in Windows, this should help.

Casperjs:

1. Either:

download the latest zip from this page: http://docs.casperjs.org/en/latest/installation.html and unzip to a safe & sensible location like C:\casperjs

or (recommended) the git method (easier to keep up to date with versions):

Via a command line (to install at C:\casperjs):

  • cd C:
  • git clone git://github.com/n1k0/casperjs.git

2. Add ;C:\casperjs\batchbin (or the correct path if you installed somewhere different) to the end of your PATH environment variable (the System one). Adding ;C:\casperjs\bin as well may be useful - I am managing to run casper without using the .bat, I assume because of git bash.