There's an installer, it's easy. http://rubyinstaller.org/
Newer macs ship with a usable version of Ruby.
Try ruby -v
in a terminal window, and if it's 1.9.x or 2.x you're fine.
http://www.railstutorial.org/book/beginning#sec-install_ruby http://tutorials.jumpstartlab.com/topics/environment/environment.html http://docs.railsbridge.org/installfest/macintosh
Ubuntu: http://docs.railsbridge.org/installfest/linux https://www.ruby-lang.org/en/installation/