As you can see below, libv8 installs fine, but therubyracer doesn\'t. I\'m using Mac 10.7.4.
~/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1> gem install lib
@Haegin's answer in https://github.com/cowboyd/libv8/issues/205
brew uninstall v8
brew install v8-315
gem uninstall -a libv8
gem uninstall -a therubyracer
gem install libv8 -v '3.16.14.17' -- --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-v8-dir=$(brew --prefix v8-315)
For Linux:
The code below is of course correct
$ gem uninstall libv8
$ gem install therubyracer
But sometimes it does't help because you haven't program make
. AT FIRST you need install make
. To do this, run:
sudo apt-get install build-essential
And only after that:
gem install therubyracer
The solution that worked for me was putting these steps together on 10.7.4
export CC=gcc-4.2
sudo ln /usr/bin/gcc /usr/bin/gcc-4.2
gem uninstall libv8
gem install therubyracer
For an older project I had to used the 0.10.1 version of rubyracer on mavericks (bootstrap depends on it)
So I had to use an older version of gcc
edit your .zshrc or .bashrc
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
be sure that you have uninstalled all older versions of libv8
gem uninstall libv8
install your version of therubyracer
gem install therubyracer -v=0.10.1
On OS X 10.7 I actually found that the "Command Line Tools" package wasn't enough, I had to install the full-blown XCode package, then gem install worked.
I had this same problem when I upgraded from OSX Mountain Lion to OSX Mavericks.
Upgrading from ruby-1.8.7-p354 to ruby-1.8.7-375 did the trick for me. If you are on ruby-1.93-p125, you may want to try upgrading to 1.9.3-rc1 (which is above p484 already)
libv8 (3.16.14.3-x86_64-darwin-13) and the therubyracer (0.12.0) gems installed without problem.
assuming you use rbenv:
rbenv install 1.9.3-rc1
rbenv rehash
rbenv shell 1.9.3-rc1
bundle install