Friday, April 22, 2016

Updating Ruby versions in a Boxen - rbenv - ruby-build Environment

TL;DR: cd /opt/boxen/rbenv/plugins/ruby-build && git pull origin master

A while ago, I set up my development environment on my two machines using GitHub's Boxen.  To be honest, I got it going and moved on.  I have not been updating it.  Then, I recently started a new Ruby project, and I wanted the latest version of Ruby.  I went into rbenv, and it had no recent versions of Ruby - none since I set up Boxen.

How do I update the list of Ruby versions available in my Boxen environment?

I could update Boxen, but that's more than I wanted to bite off.  My first guess was to run brew update and brew upgrade rbenv ruby-build, but that failed because rbenv is part of the bootstrap of Boxen and not installed by Boxen's version of Homebrew.

So, I thought I'd need to update rbenv directly.  I figured it was installed as a git repo.  The question was: where?  which rbenv says it's a shell function.  Looking at that code, it un-aliases itself to run.

which -a  shows that rbenv is in /opt/boxen/rbenv/bin/rbenv.   From there I found the ruby-build plugin, which leads to the solution:

cd /opt/boxen/rbenv/plugins/ruby-build
git pull origin master

It's not like it's rocket-surgery, but it was a curious puzzle to sort out.  Soon I should update my Boxen environment, but that's a story for another day.


No comments: