Installing PhantomJS on Mac

jblakeley picture jblakeley · May 3, 2016 · Viewed 37.9k times · Source

I'm trying to install PhantomJS on my Mac (Yosemite).

I did the following:

npm install phantomjs

Then I did:

npm install phantomjs-prebuilt

Both of which appear in my node_modules. But when I try to run phantomjs --versionI get

   -bash: phantomjs: command not found

Also tried installing the binary from the downloads website, but nothing. What am I missing? End goal is to use casperjs but currently casper is asking

Fatal: [Errno 2] No such file or directory; did you install phantomjs?

I thought I did....?

Answer

Vladtn picture Vladtn · Sep 21, 2017

If you are using Homebrew, you can type:

brew tap homebrew/cask
brew cask install phantomjs