Categories
AntiFUD

Updating Ruby and Rails with rbenv

If you installed both Ruby and Rails using rbenv, then updating will be a breeze… more or less. Before updating anything though, install the plugin rbenv-updater if you didn’t already.

Updating and installing the new ruby version is quite easy:

> rbenv update
> rbenv install -l | grep ^[0-9]
list of Ruby versions
> rbenv install -v <version>

From within your rails project update the files .ruby-version and Gemfile with the appropriate ruby version, and if you’re doing a rails upgrade as well update the Gemfile accordingly. Then issue the commands:

> bundle update --bundler
> rails app:update
file checks will be needed here

Start your server with puma or rails s and check that everything is working properly. If you need to downgrade due to troubles, you can revert the version changes in the files, delete the Gemfile.lock if needed, issue a bundle uninstall which will end quickly, and you’re done. No harm, no foul.

Leave a Reply

Your email address will not be published. Required fields are marked *