This post is over 6 months old. Some details, especially technical, may have changed.

rbenv and CodeRunner

You know CodeRunner right? If not maybe you should go check it out. It's and aptly named little tool for running code snippets in various languages much like what LinqPad does for the .NET folks. I've been using it extensivley recently to test out little Ruby and Scala snippets. Thing is though - I hit a snag. By default CodeRunner will run the system ruby executable (1.8 in OSX) and I generally use rbenv along with version 1.9.whatever so some of my scripts started behaving a little... odd.

But hey it's an easy fix,

  • Open your CodeRunner Preferences
  • Select the Languages tab
  • Select Ruby in the Language List
  • Change the run command from ruby $filename to ~/.rbenv/shims/ruby $filename





Blam - global rbenv version is now the goto version for CodeRunner. OK so it won't work with rbenv locals but I am sure you can tweak it to make it work (I haven't needed it so never looked).

Published in Ruby on March 22, 2012