Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Therubyracer + libv8 in Mavericks with ruby-1.9.3-p448 issue


If therubyracer gives you a problem like this one when installing it:

ERROR:  Error installing therubyracer:
  ERROR: Failed to build gem native extension.

    /Users/tonatiuh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for main() in -lobjc... yes
creating Makefile

compiling rr.cpp
clang: warning: argument unused during compilation: '-rdynamic'
rr.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
rr.cpp:151:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]

Follow the next steps to be able to install it:

rew tap homebrew/dupes
brew install apple-gcc42

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

brew uninstall v8

gem uninstall libv8

gem install therubyracer -v '0.9.9'

Source: Link


If installing libv8 gem gaves you an error like this one

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/tonatiuh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
creating Makefile
Configured with: --prefix=/Applications/ --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.

Try this, it worked for me:

gem install libv8 -v <version> -- --with-system-v8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment