How to install phantomjs on Mac

Phantomjs on Mac can be installed using Brew or node npm. It can also be downloaded from phantomjs site. We’ll use npm to install phantomjs in this tutorial. Here are the steps to install phantomjs on Mac command line.

  1. First install node and npm on Mac if not already installed.
  2. Get info about phantomjs package

    $ npm info phantomjs
    { name: 'phantomjs',
      description: 'Headless WebKit with JS API',
      'dist-tags': { latest: '2.1.3', alpha: '2.0.0-alpha' },
    ...
    ...
    
  3. Install phantomjs using npm in global mode

    $ npm install -g phantomjs
    $ npm ls -g | grep phantomjs
    └─┬ phantomjs@2.1.3
    
  4. Check if phantomjs is working

    $ phantomjs --version
    2.1.1
    
  5. Check where is phantomjs installed

    $ which phantomjs
    /usr/local/bin/phantomjs
    $ ls -l /usr/local/bin/phantomjs
    lrwxrwxr-x  1 user1  admin  43 Feb 25 23:57 /usr/local/bin/phantomjs -> ../lib/node_modules/phantomjs/bin/phantomjs
    
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments