Last Updated: February 25, 2016
·
1.58K
· curtis

Specify a Ruby Version on Heroku

To find out what version of Ruby you're currently using on Heroku:

$ heroku run 'ruby -v'
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

Not the version you wanted to use? Don't worry, Heroku supports multiple Ruby versions, but you need to specify it.

First, update your version of bundler:

gem install bundler --pre

Then, in your Gemfile add the version of Ruby you'd like to use:

source :rubygems

ruby '1.9.3'
...

Don't forget to bundle, commit your changes and deploy to Heroku. During deployment you should now see:

...
-----> Using Ruby version: ruby-1.9.3
...

To verify that it worked, check the Ruby version again:

$ heroku run 'ruby -v'
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]

There you go, you're now all set to specify a Ruby version on Heroku!