Install and run phantomjs on MAC

Maybe it’s too easy?There are no tramp tutorials on

Search phantomjs on your MAC and get the following method:

Download and unzip. Bin/Phantomjs is directly available.

Or it can be installed through Homebrew

brew update & & brew install phantomjs

Or install via MacPorts

sudo port selfupdate & & sudo port install phantomjs

These are the three ways to do it, and they all make a dent.

Let’s start with the method that will ultimately make my installation a success: using Homebrew.

What is Homebrew?

The Missing Package Manager for OS X (The indispensable Package Manager for OS X)


It is very simple to execute the command line directly from the MAC terminal

The/usr/bin/ruby – e “$(curl – fsSL”


Enter BREW – V to see the version number, indicating a successful installation.

Install phantomjs:

Type BREW Update (I didn’t enter it, the next install will automatically help me update.)

Wait until the update is complete before typing
Brew Install Phantomjs. Installed successfully! Enter the PhantomJs-V view number to confirm.

A simple hello. Js:

console.log(“Hello,world!” );



The directory where the JS file is running on the CD

Phantomjs hello. Js

Output Hello, world!

Read More: