Installing therubyracer and libv8 with Ruby 1.8 on OSX Mavericks

Updated . Posted . Visible to the public.

There seems to be no way to use therubyracer -v '0.11.4' and libv8 -v '3.11.8.17' on OS X Mavericks.

However, running bundle update therubyracer worked for me. It installed therubyracer -v '0.12.1' and libv8 -v '3.16.14.3' and I had not side effects.


Log of my attempts to get it working

Probably you got here when bundling failed building native extensions for therubyracer.

The libv8 (3.3.10.4) should have been installed when bundling. Unfortunately it is not building correctly on Mavericks, so the libv8.a file that therubyracer needed is never created. We'll first install v8 via brew and then symlink the required file into the gem:

brew install v8

# select the right version of <RUBY> and <LIBV8>
ln -s /usr/local/Cellar/v8/3.21.17/lib/libv8_base.x64.a ~/.rvm/gems/<RUBY>/gems/<LIBV8>/lib/libv8/build/v8/libv8.a

There are solutions proposing exporting environment variables like CC, but I found that old versions of libv8 were not using it Show archive.org snapshot .

I'm still getting LoadError: dlopen(/Users/makandra/.rvm/gems/ruby-1.8.7-p374/gems/therubyracer-0.9.9/ext/v8/v8.bundle, 9): Symbol not found: __ZN2v88internal8Snapshot13context_size_E

Helpful threads on this topic

Also see Installation of therubyracer fails with "undefined method `include_path'"

Dominik Schöler
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Dominik Schöler to makandra dev (2014-01-13 15:25)