Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mytrile/f8d3dd6da7c3b79d30fb to your computer and use it in GitHub Desktop.
Save mytrile/f8d3dd6da7c3b79d30fb to your computer and use it in GitHub Desktop.
PhantomJS 1.9.8 - Selectable Text

There is a bug in PhantomJS on Mac OS X that doesn't render an HTML page as selectable text. It will be fixed in PhantomJS 2.0, so for now you'll have to apply a patch when installing with Homebrew.

First, update homebrew formulae:

$ brew update

If you already have PhantomJS installed, then remove it:

$ brew uninstall phantomjs Next, the PhantomJS formula needs to be edited to apply a patch that fixes native text rendering in Mac OS X:

If, you previously had 2.0 installed, you'll need to rollback to 1.9.8:

$ cd `brew --prefix`
$ git checkout 9089836 # 1.9.8 release

Edit the Formula

$ brew edit phantomjs

Add these lines after any other patches blocks and before the def install method:

patch do
  url "https://github.com/ariya/phantomjs/commit/0663263bfa748b0933d7eff4b5e49d9ed97bcc84.diff"
  sha1 "ac0f7f967d8b5a3a49c8f6654f8182ffb99391f5"
end

Finally, reinstall PhantomJS from source via homebrew and go do something else since your computer will be at 100% CPU for about 30 minutes:

$ brew install phantomjs --build-from-source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment