How to install therubyracer gem on 10.10 Yosemite?

Maybe it will be useful for someone but I had problems installing therubyracer (because of the problems with libv8) the solution was to uninstall all the libv8 that I had installed. Install therubyracer

$ gem uninstall libv8
$ gem install therubyracer -v '0.12.0'
Fetching: libv8-3.16.14.7-x86_64-darwin-14.gem ( 57%)
Fetching: libv8-3.16.14.7-x86_64-darwin-14.gem (100%)
Successfully installed libv8-3.16.14.7-x86_64-darwin-14
Building native extensions.  This could take a while...
Successfully installed therubyracer-0.12.0
2 gems installed

I hope this helps someone.


gem uninstall libv8
brew install v8
gem install therubyracer
gem install libv8 -v '3.16.14.3' -- --with-system-v8

this is the only way it worked for me on 10.10 (ruby 2.1.2)

Or try gem install libv8 -v 'XX.XX.XX' -- --with-system-v8 adding the version of the gem :)

UPDATE for Mac OS Catalina:

brew tap homebrew/versions
brew install [email protected]
brew link --force [email protected]
gem install libv8 -v 'XX.XX.XX' -- --with-system-v8
gem install therubyracer

None of the answers work for me this time. I have too use this:

brew tap homebrew/versions
brew install v8-315

gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315

bundle install

Seen on the rubyracer Github issues.

Hope it helps someone else.


git clone https://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake clean build binary
gem install pkg/libv8-3.16.14.3-x86_64-darwin-12.gem #note that libv8 version may change, so tab through files in pkg/, also remember to use the one with version specified

then just bundle your project gems

this is the only way it worked for me on 10.10 (ruby 2.1.2)

Tags:

Ruby

Rubygems

Gem