Skip to content

PhantomJS on El Capitan

Todd Tyree edited this page Dec 2, 2015 · 9 revisions

01-Dec-2015

Both the specs in the app and the smoke tests, which are semi-standalone, require PhantomJS.

The current PhantomJS homebrew package will not install on El Capitan. It complains that it only supports OSX up to Yosemite.

For the application, proper, this is worked around using the phantomjs gem:

gem 'phantomjs', require: 'phantomjs/poltergeist'

However, the smoke tests do not run under bundler, and so will fail with capybara complaining that it cannot find phantomjs in the path. The current prebuilt version of PhantomJS2 in the zipfile downloadable from phantomjs.org is built for Lion (10.0.7) and also will not run on El Captian.

The two workarounds are to install 1.9.8 using node:

npm install phantom phantomjs -g

Or, if you want version 2.0, build from source:

http://phantomjs.org/build.html

That said, the source build is painful as the instructions have subtle errors (you cannot checkout branch 2.0.0 without having a conflict with the qt submodule–you have to move it out of the way before changing branches), and build.sh issues this warning when you run it:

---------------------------------------
               WARNING
----------------------------------------

Building PhantomJS from source takes a very long time, anywhere from 30
minutes to several hours (depending on the machine configuration).
We recommend you use the premade binary packages on supported operating
systems.

The smoke tests run fine with version 1.9.8, so I did not try to build it from source.