Skip to content

Instantly share code, notes, and snippets.

@jordanandree
Created March 4, 2015 15:31
Show Gist options
  • Save jordanandree/3e6d37ce7aa68ed6fa43 to your computer and use it in GitHub Desktop.
Save jordanandree/3e6d37ce7aa68ed6fa43 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
@alicedead
Copy link

Hi, thanks for gist!

It will be fixed in PhantomJS 2.0, so for now you'll have to apply a patch

Will not be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment