Skip to content

PhantomJS installation

Thomas D edited this page Nov 11, 2020 · 4 revisions

For this reason, ensure to install a version > 2

Linux (Debian, Ubuntu, Kali and distributions providing a native package)

  1. apt-get update && apt-get install phantomjs (replace apt-get by your distribution package manager)

Linux (other distributions)

  1. First, install some dependencies

  2. Get the latest phantomjs program. The current version was 2.1.1 at the time of writing this tutorial.
    http://phantomjs.org/download.html
    https://bitbucket.org/ariya/phantomjs/downloads

  3. Download it on your system (choose 32 or 64bits) and untar it wherever you want, let's say /opt
    $ cd /opt
    $ wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
    $ tar xvf phantomjs-2.1.1-linux-x86_64.tar.bz2

  4. Make a symlink to the phantomjs binary in your /usr/local/bin directory
    $ ln -s /opt/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs

  5. Execute the binary with the -v option to check that everything works
    $ phantomjs -v
    2.1.1

Windows

  1. Get the latest phantomjs program. The current version was 2.1.1 at the time of writing this tutorial.
    http://phantomjs.org/download.html
    https://bitbucket.org/ariya/phantomjs/downloads

  2. Download it on your system and untar it wherever you want, let's say C:\Program Files\phantomjs-2.1.1-windows

  3. Add C:\Program Files\phantomjs-2.1.1-windows to the PATH environment variable (user or system, whatever)

  4. Open a command prompt and execute the binary with the -v option to check that everything works
    phantomjs -v
    2.1.1

macOS

webscreenshot is not tested on macOS but this post explains that phantomjs can be installed that way:

  1. $ brew tap homebrew/cask
  2. $ brew cask install phantomjs
Clone this wiki locally