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.
- First install node and npm on Mac if not already installed.
-
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' }, ... ...
-
Install phantomjs using npm in global mode
$ npm install -g phantomjs $ npm ls -g | grep phantomjs └─┬ phantomjs@2.1.3
-
Check if phantomjs is working
$ phantomjs --version 2.1.1
-
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