• Skip to main content
  • Skip to primary sidebar

Ryan McCormick

How to Install PhantomJS 2.5 Beta on MacOS

March 19, 2017 by Ryan Leave a Comment

PhantomJS on MacOS is a quick, excellent alternative to Google Chrome for a native browser testing platform. The beta version, PhantomJS 2.5 offers support for ES2015 unlike the current stable branch (at the time of writing this article 2.1.x).

Download PhantomJS 2.5 for MacOS

At the time of writing this article, the following versions are available:

  • Ubuntu 16.04 LTS (xenial)
  • Ubuntu 14.04 LTS (trusty)
  • MacOS – unsure if works on El-Capitan or Yosemite. Will find a way to verify in the future.

Download the version for your operating system from:
https://bitbucket.org/ariya/phantomjs/downloads/

Add PhantomJS to Your Path

TL;DR Advanced

You can find the PhantomJS binary under the bin dir of the zip archive. If you have a preferred way of adding items to your path, go ahead and add it. If you don’t have a clue what a path is, then you can follow along below.

  1. After adding to your path, verify by running which phantomjs from the command line.
  2. If everything looks good and you see the correct path, add the PHANTOMJS_BIN variable to your environment by typing export PHANTOMJS_BIN=`which phantomjs`
  3. NOTE: Notice that my example uses the back-tick character and NOT the single quote mark in the example above!

Add PhantomJS to Your Environment

These instructions are based off of the assumption that you downloaded the PhantomJS zip to your downloads directory.

  1. Open your terminal and make sure you are in your home dir.
  2. Type mkdir ./.phantomjs
  3. Move to your new dir cd .phantomjs
  4. Move your archive into your folder cp ~/Downloads/phantomjs-2.5.0-beta-macos.zip ./ (make sure you reference the correct file, as you are typing the filename, you can try hitting the tab key for autocomplete)
  5. Extract your archive unzip ./phantomjs-2.5.0-beta-macos.zip
  6. Rename the extracted dir mv phantomjs-2.5.0-beta-macos phantomjs
  7. Move into the extracted phantom dir cd phantomjs
  8. Move into the phantom bin dir cd bin
  9. Add executable permissions chmod +x phantomjs
  10. Add to your path sudo ln -s `pwd`/phantomjs /usr/local/bin
  11. Test by typing: phantomjs --version (at this point you should see the version. At the time of this post, 2.5.0-development).
    • If the console yells at you with an error about the webp library: /usr/local/lib/libwebp.6.dylib, I posted a solution here: SOLVED: PhantomJS 2.5 Beta: Library not loaded: libwebp.6.dylib
    • If you don’t get a version, you may need to add execute permissions. Browse back to your extracted phantom bin dir and type chmod +x phantomjs. Try checking your PhantomJS version again. If you still don’t see version information, type source ~/.bash_profile and type which phantomjs (you should see a path to the phantomjs bin folder)
  12. After you have verified that you are showing phantomjs 2.5+, you need to add the PHANTOMJS_BIN variable to override other global installations. type: echo "export PHANTOMJS_BIN=`which phantomjs`" >> ~/.bash_profile
  13. Close and re-open your terminal or type: source ~/.bash_profile
  14. Verify PHANTOMJS_BIN var: echo $PHANTOMJS_BIN (you should see the executable path for your phantomjs 2.5).

Filed Under: MacOS Tagged With: install phantomjs 2.5 beta on macos, phantom typescript, phantomjs

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • Force Quit Kill all Chrome Windows MacOS
  • SOLVED: Angular 6 CLI Karma Stuck in Single Run | Karma Stops Running
  • How to Manually Install Java 8 on Ubuntu 18.04 LTS
  • Remove VirtualBox from Ubuntu 16.04 Xenial
  • Clear all Node Modules Folders Recursively Mac/Linux

Recent Comments

  1. KKV on Webstorm adding spaces between imports and braces | JavaScript and TypeScript
  2. jusopi on Clear all Node Modules Folders Recursively Mac/Linux
  3. Qaisar Irfan on Clear all Node Modules Folders Recursively Mac/Linux
  4. mustafa on Remove VirtualBox from Ubuntu 16.04 Xenial
  5. Pourya on How to Manually Install Java 8 on Ubuntu 18.04 LTS

Copyright © 2025 · Magazine Pro on Genesis Framework · WordPress · Log in