On some machines, installing Ruby 1.8.7 with ruby-build can lead to this error:
math.c:37:13: error: missing binary operator before token "("
Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.
Try instead to install ruby-1.8.7-p374.
ruby-1.8.7-p374