Last Updated: February 25, 2016
· jonathannelson

Fix therubyracer Gem for OS X Mountain Lion

If you're receiving the following error message then chances are you're trying to install therubyracer gem on OS X Mountain Lion:

$ make
$ compiling rr.cpp
$ make: g++-4.2: No such file or directory
$ make: *** [rr.o] Error 1

Luckily there's an easy fix.


Make sure you've installed Xcode 4 Command Line Tools so that your g++ directory is in /usr/bin.


$ cd to /usr/bin
$ sudo ln -s g++ g++-4.2

One Liner

$ cd /usr/bin/ && sudo ln -s g++ g++-4.2

1 Response
Add your response

You could also just not use therubyracer on Mac OS X and instead install a proper JavaScript runtime via Node.js

over 1 year ago ·