Home How to install therubyracer gem on 10.10 Yosemite?
Reply: 15

How to install therubyracer gem on 10.10 Yosemite?

Nicolas Blanco
Nicolas Blanco Published in 2014-06-06 12:07:17Z

I don't manage to install therubyracer gem on Yosemite 10.10.

Here is the log:

11:53  $ gem install libv8 -v '' -- --with-system-v8

Building native extensions with: '--with-system-v8'
This could take a while...
Successfully installed libv8-
Parsing documentation for libv8-
Installing ri documentation for libv8-
Done installing documentation for libv8 after 0 seconds
1 gem installed

02:05  $ gem install therubyracer -v '0.12.1' -- --with-system-v8

Building native extensions with: '--with-system-v8'
This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

    /usr/local/var/rbenv/versions/2.1.2/bin/ruby extconf.rb --with-system-v8
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
/usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8- `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with installed. You may
need to special --with-v8-dir options if it is in a non-standard

The Mgmt

    from /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8- `configure_makefile'
    from extconf.rb:32:in `'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/therubyracer-0.12.1 for inspection.
Results logged to /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/therubyracer-0.12.1/gem_make.out
mymlyn Reply to 2014-10-31 22:44:02Z
git clone https://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake clean build binary
gem install pkg/libv8- #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)

Borromakot Reply to 2014-06-12 19:23:39Z

They have corrected this issue in the most recent version of libv8. See: https://github.com/cowboyd/libv8/issues/123

You should install from the github repo, in rails I added a line to my gemfile like this gem "libv8", git: "git://github.com/cowboyd/libv8.git", submodules: true


This apparently only solves some of the problem. I installed the new version of libv8, but now the rubyracer is still looking for the other one I think? Still looking into it.

Wylkon Reply to 2015-03-31 17:57:36Z
gem uninstall libv8
brew install v8
gem install therubyracer
gem install libv8 -v '' -- --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 :)

Jakub Troszok
Jakub Troszok Reply to 2016-01-08 15:20:20Z

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- ( 57%)
Fetching: libv8- (100%)
Successfully installed libv8-
Building native extensions.  This could take a while...
Successfully installed therubyracer-0.12.0
2 gems installed

I hope this helps someone.

Martin Streicher
Martin Streicher Reply to 2014-11-16 16:22:40Z

I had the same issue on Yosemite. My solution is similar to what appears above.

Use gem uninstall libv8 to remove anything that might be installed.

Leave therubyracer in your Gemfile, but remove any explicit reference to libv8.

Run bundle install.

libv8 then installed fine as a dependency.

CloudMagick Reply to 2014-11-17 18:18:14Z

I was able to proceed with ruby racer after rm Gemfile.lock

beforehand: I installed v8 via brew install v8, and then did gem install libv8 -v '' -- --with-system-v8

and I am running 10.10 Yosemite

M.G.Palmer Reply to 2014-11-29 20:48:29Z

It seems like this has been fixed upstream. What worked for me and @aurels and @Mike Causer and @Juanda was:

bundle update libv8
Chris Beck
Chris Beck Reply to 2014-12-18 16:47:09Z

I did the following

gem install therubyracer

which now installs therubyracer 0.12.1 which installs the dependency libv8 ( x86_64-darwin-14) which installed with no errors.

I did this using ruby 2.1.5 which I installed via:

CC=/usr/bin/gcc rbenv install 2.1.5

which I did after running brew upgrade ruby-builds.

After installing ruby 2.1.5, I also ran

gem upgrade --system

to get rubygems-update 2.4.5

Qiu Reply to 2015-04-26 19:17:28Z

After hours of trying simply upgrading ruby worked:

brew install ruby 

and then adding the following to gem file:

gem 'libv8'  
gem 'therubyracer' 
abcd_win Reply to 2015-03-05 14:15:32Z

this happens due to some conflicts with the libv8 as well, although you can just assign a version to the rubyracer and it will be installed:

change the following in the gemfile:

gem 'therubyracer', '~> 0.12.1'

and do bundle install

tufla Reply to 2015-04-22 01:21:33Z

What worked for me, based on the following comment,


was to remove Gemfile.lock and then run bundle install

RohanDaxini Reply to 2015-05-06 13:58:29Z

This worked for me very well on my Yosemite and Ruby 2.1.5 (Ruby through RVM)

gem install libv8 -v '' -- --with-system-v8

Earlier it was giving me error Gem::Ext::BuildError: ERROR: Failed to build gem native extension. for libv8 gem version

aquajach Reply to 2015-08-06 06:44:42Z

Only this works for me in my Yosemite, Ruby 2.1.2:

gem install libv8 -v '' -- --with-system-v8
brew link --overwrite v8-315 --force
gem install therubyracer -v '0.12.2' -- --with-system-v8
colsen Reply to 2015-08-21 21:38:16Z

A heads up to anyone that might have been having my issue: I ended up uninstalling my ruby version in RVM and then reinstalling it. That seemed to use the correct dependancies in the latest version of xcode tools for compiling ruby.

rvm list
rvm uninstall ruby-x.x.x
rvm install ruby-x.x.x
coding addicted
coding addicted Reply to 2016-04-03 16:50:08Z

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 '' -- --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.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.319521 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO