Pages

.

Install PhantomJSDriver on Mac bypassing "Operation not permitted"



Introduction

I use PhantonJS Driver for screenscraping. The pages that are loaded contain JavaScript which loads the HTML. PhantomJS will render the pages in HTML.

I downloaded PhantomJS from their Download page. When I tried to put it into my /usr/bin directory so it would be on my path, I got the following error message.

Error Message:
cp ~/Tools/phantomjs-2.1.1-macosx/bin/phantomjs /usr/bin/
cp: /usr/bin/phantomjs: Operation not permitted


How I got around this Error

I have a ~/Tools directory that I use for these development tools. I used the ~/.bash_profile file to add it to the $PATH.


  1. Unzip PhantomJS into the ~/Tools directory.
  2. Add the location of phantomjs to the $PATH via the ~/.bash_profile.
  3. vim ~/.bash_profile
  4. export PATH=$PATH:~/Tools/phantomjs-2.1.1-macosx/bin
  5. source ~/.bash_profile
  6. Test if it is added to your CLI by executing `phantomjs`, to exit `Ctrl+C`.


No comments:

Post a Comment