There's an installer, it's easy. http:https://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:https://www.railstutorial.org/book/beginning#sec-install_ruby http:https://tutorials.jumpstartlab.com/topics/environment/environment.html http:https://docs.railsbridge.org/installfest/macintosh
Ubuntu: http:https://docs.railsbridge.org/installfest/linux https://www.ruby-lang.org/en/installation/