Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`gem install therubyracer` fails on Mac OS X Lion

Tags:

ruby

rubygems

v8

I would appreciate some help in getting gem install therubyracer to work. Here is the error:

$ gem install therubyracer
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

        /Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for main() in -lobjc... yes
*** 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:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-objclib
    --without-objclib
extconf.rb:15:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)

Here are some notable steps that I ran before the error. They worked fine:

$ gem install libv8
$ brew install v8

My environment is:

  • Mac OS X Lion 10.7.4
  • ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0] (via rvm)
  • V8 version 3.9.24 (via homebrew)
like image 274
David J. Avatar asked Jun 05 '12 22:06

David J.


2 Answers

This worked for me:

$ gem uninstall libv8
$ gem install therubyracer

(A big thanks to http://www.ruby-forum.com/topic/4306127)

like image 148
David J. Avatar answered Oct 23 '22 08:10

David J.


gem uninstall libv8
brew install v8
gem install therubyracer
like image 43
Ken Mazaika Avatar answered Oct 23 '22 07:10

Ken Mazaika