Ruby on Rails depends on the Ruby programming language (doh), so we need to install that first. Follow the Ruby Setup guide to install a local version of Ruby.
Install the latest version of Rails
gem install rails
Or install a specific version (4.2.5.1
for example)
gem install rails --version 4.2.5.1
You can check which version was installed
rails -v
Rails needs a JavaScript runtime to work, we will install the latest version of node.js with nvm. Follow the instructions here to install nvm: https://github.com/creationix/nvm#install-script.
Check which versions of node.js are available
nvm list-remote
Then install the latest version of node.js (5.6.0
for example)
nvm install 5.6.0
Use it
nvm use 5.6.0
And make it the default version
nvm alias default 5.6.0
You might want to install PostgreSQL and other stuff, but for trying out and playing around with Ruby on Rails, the above are enough.
Just go to http://guides.rubyonrails.org/getting_started.html and follow along with creating your first Rails app.