mini_racer is a lighter and faster alternative to therubyracer javascript engine. It uses a much newer version of libv8 compare to therubyracer. For most applications, you don't need the extra features provided by therubyracer and you can easily replace it with mini_racer. 

If you are using an old OS, such as Ubuntu 12.04 or CentOS 6.x, you might get an error when installing mini_racer gem.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

To build the underlying libv8, you need a newer gcc-c++ build tool.

For CentOS 6.9:

sudo rpm --import

wget -O /etc/yum.repos.d/slc6-devtoolset.repo

sudo yum install devtoolset-2-gcc-c++

scl enable devtoolset-2 bash

For Ubuntu 12.04:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++