An error occurred while installing libv8 – Mavericks

I upgraded to OS X Mavericks, and I’ve been seeing this error while bundling older Rails projects:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
...
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
...
An error occurred while installing libv8 (3.11.8.13), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.11.8.13'` succeeds before bundling.

To get past it, try updating your Gemfile, specifying a newer version of therubyracer

gem 'therubyracer', '~> 0.12.0'

then run bundle again to update therubyracer and it’s dependencies.

Comments

    mad |

    Thanks!

    Sheldon |

    After following 3 different solutions on stackoverflow, all which failed, this simple tip succeeded. Thanks!

    Ricardo Aum |

    Oh god, thanks for that. I spent at least 3 hours of my afternoon stuck on this one.

    Jason |

    Great solution, like Ricardo said, I have been choking on this for an afternoon with these crazy solutions I was finding on stack overflow, this worked perfectly! +1