Skip to content

Instantly share code, notes, and snippets.

@jordanandree
Created March 4, 2015 15:31
Show Gist options
  • Select an option

  • Save jordanandree/3e6d37ce7aa68ed6fa43 to your computer and use it in GitHub Desktop.

Select an option

Save jordanandree/3e6d37ce7aa68ed6fa43 to your computer and use it in GitHub Desktop.

Revisions

  1. jordanandree revised this gist Mar 4, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion phantomjs_selectable_text.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    There is a bug in PhantomJS on Mac OS X that doesn't render an HTML page as selectable text. <del>It will be fixed in PhantomJS</del> 2.0, so for now you'll have to apply a patch when installing with Homebrew.
    There is a bug in PhantomJS on Mac OS X that doesn't render an HTML page as selectable text. <del>It will be fixed in PhantomJS 2.0</del>, so for now you'll have to apply a patch when installing with Homebrew.

    First, update homebrew formulae:
    ```
  2. jordanandree created this gist Mar 4, 2015.
    35 changes: 35 additions & 0 deletions phantomjs_selectable_text.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    There is a bug in PhantomJS on Mac OS X that doesn't render an HTML page as selectable text. <del>It will be fixed in PhantomJS</del> 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
    ```