Announcement (2017-05-07): www.ruby-forum.com is now read-only since I
unfortunately do not have the time to support and maintain the forum any
more. Please see rubyonrails.org/community and ruby-lang.org/en/community
for other Rails- und Ruby-related community platforms.

Rails hosts, for instance Heroku, are strongly advising against
therubyracer because of memory usage.
I removed therubyracer from my gems and just did $sudo apt-get install
nodejs.
Not sure if that is the preferred method, but it works for me.

I found a similar problem, but got a little nugget of info in the error
on OS X 10.8 Mountain Lion:
make
compiling rr.cpp
make: g++-4.2: No such file or directory
make: *** [rr.o] Error 1
I found that all you need to do on Mountain Lion is:
1: Make sure you've installed Xcode command line tools so that the g++
directory is in /usr/bin
2: Type "sudo ln -s g++ g++-4.2"
Enjoy :)