Updating Ruby (not a real blog post!)

This isn’t a real blog post. I just want to state that up front. I know it’s been ages since my last one (if anyone’s counting) and that one was about a bunch of feels and I should probably follow it up with a really good one. But I’m not. You’ve been warned. 🙂

A few weeks ago, I had to update my Ruby version twice in a 3 week period. Both times I had to look up how to do it (I love having an exo-brain called Google that means I don’t have to remember every single thing), and both times I didn’t find everything I needed to know in one place. Talk about frustrating.

So I wrote some notes detailing the process, with every command needed. And now I’m going to post it here, because surely someone else has been through what I’ve been through and would like to have access to step-by-step instructions so the next time they update Ruby they’re not hunting in multiple places to find what they need. Right? (Also, it will be in a handy place for me the next time I need it.)

Note: these instructions are based on having rbenv and brew already installed.

Start with:

rbenv install -l

This shows a list of the different versions of Ruby that are available. If the one you’re looking for isn’t on there (which it likely won’t be as you are trying to install the latest version), use:

brew upgrade ruby-build

Next, actually install the new version:

rbenv install 2.2.3

(or whatever the new version is)

Set the new version locally:

rbenv local 2.2.3

Set the new version globally:

rbenv global 2.2.3

Double check that it’s been installed properly:

ruby -v

Bundler needs to be reinstalled when Ruby is upgraded:

gem install bundler

Run bundle to reinstall all of the gems in the Gemfile, including updating Rails if it also has a new version:

bundle install

Finally, double check that Rails has updated:

rails -v

Done!

Advertisements

4 thoughts on “Updating Ruby (not a real blog post!)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s