FAQ

Frequently Asked Questions

How to install PhantomJS?

How to install PhantomJS on Ubuntu

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev

Install these packages needed by PhantomJS to work correctly.

sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev

Get it from the PhantomJS website.

cd ~
export PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2

Once downloaded, move Phantomjs folder to /usr/local/share/ and create a symlink:

sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

Now, It should have PhantomJS properly on your system.

phantomjs --version

How to install PhantomJS on Windows

 

  • Right click on the downloaded phantomJs zip file to Extract All
  • Copy all the contents located in phantomjs-X.X.X-windows
  • On your drive, create a new directory structure C:\PhantomJs\bin\phantomjs
  • Paste the contents on the extracted phantomjs-X.X.X-windows directory here:

 

  • Copy the path of the phantomjs directory (C:\PhantomJs\bin\phantomjs)
  • Right click on my computer and select Properties
  • Select Advanced system settings
  • Click on the Environment Variables.. button
  • Under the System Variables section, find the Path variable

 

  • Click on the Edit.. button
  • At the end of the existing Path, add a semicolon (;) and then the path to the following

C:\PhantomJs\bin\phantomjs

 

  • Click OK

Cool! Now, according to the PhantomJs documentation, we should have all we need to get started since the binary is self-contained and has no external dependencies.

How to install PhantomJS on Mac

brew install phantomjs

Video tutorials