chruby - Minimal ruby version switching

16 June 2013

So, like many other compadres in the ruby world, I too have simplified my ruby version-switching, using the kick-ass chruby, written in less than 90 lines of code. I have been working on setting up a development environment for our interns here at Acorns, and wished to avoid submitting them to the nonsense that is RVM (since bundler takes care of ‘gemsets’ in the first place).

I’ve been using rbenv recently, with great results. However, I think that I like chruby even more, if only for its minimalism.

Why would I use chruby?

  • It’s straight-up simple.
  • No gemsets
  • No shims

1 caveat: chruby does not assist in installing new versions of ruby. You’ll need a tool like ruby-install to help manage this. (Instructions included below)

How do I get started?

  • Install chruby with homebrew brew install chruby
  • Add the below line to your .bash_profile source /usr/local/share/chruby/
  • (Optionally) add the below line to your profile in order to automatically look for a .ruby-version file and auto-switch source /usr/local/share/chruby/
  • Install ruby-install to help manage ruby installations. brew install
  • Install the latest version of Ruby 1.9 (ruby-install will handle patch numbers for you) ruby-install ruby 1.9
  • Set a default ruby chruby ruby-1.9

How basic is that? Keep in mind, you’ll need to reinstall system wide gems like bundler to dive right into your projects.

Keep it Static, Stupid

01 March 2013

I gave a lightning(time-limited) talk at OCRuby last night, Thursday February 28th. The subject of my discussion was static site generators, for both high traffic sites, and when content is relatively, well, static.

You can see my slides here

RVM... Just Get Rid of It

17 February 2013

Gemset? Why should I compartamentalize my ruby dependencies if I am already using a Bundler? Isn’t that redundant? Yes, you are correct.

Recently, I have been configuring a Jenkins server to run our builds at work. We run a number of rails projects on the same ubuntu box, some on ruby 1.8.7 and some on 1.9.3. We run RVM and create a gemset for each project. RVM causes a number of issues when you are running bash scripts (jenkins runs each build using a shell script). Instead of whining about RVM, I much prefer to walk you through the process of replacing it with rbenv.

With proper bundler user, gemsets are unnessecary. Instead, define the gems required for a project in the project’s Gemfile. Then, run bundle install. rbenv is easily configured(see below!) to install gems to a projects’ vendor directory instead the default system gems.

Each application will be confined to only using gems defined in its Gemfile. However, please remember to refrain from installing gems with the gem install, except for global gems. The only gem that you should install manually is Bundler.

Replace RVM with rbenv

  1. Uninstall RVM.
    rvm implode
    gem uninstall rvm
  2. Remove this line from your .bash_profile (or .zshrc)
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
  3. Install rbenv & ruby-build(to install different ruby versions)
    brew update
    brew install rbenv
    brew install ruby-build
  4. Install your favorite version of ruby. A few examples are provided
    rbenv install 1.9.3-p327
    rbenv install 2.0.0-preview2
  5. Rehash rbenv (do this after installing binaries)
  6. Add these lines to ~/.bundle/config
    BUNDLE_PATH: vendor
    BUNDLE_BIN: vendor/binstubs
  7. Add this line to your ~/.bashrc
  8. Add these lines to your .bash_profile
    if [ -f ~/.bashrc ]; then
    source ~/.bashrc
  9. source ~/.bash_profile
  10. Enjoy life without gemsets!

Special thanks to Harry Marr for his directions that inspired this post.

Commanding Arduino with Siri via Ruby

27 January 2013

Your iPhone can’t make your toast, eh? Thanks to a SiriProxy plugin that I wrote this weekend (hooray for weekend projects) siriproxy-arduino, maybe it can.* Austinbv from Pivotal Labs provided the code for the ‘dino’ gem, which allows for simple control of Arduino via Ruby.

While the above video is a simple proof of concept merely controlling the Arduino’s onboard LED, consider my plugin to be a boilerplate for your Arduino & Siri based home automation projects.

For quick reference, I posted the contents of my basic plugin so you can see how simple it is to get started. Jumpstart Labs has a nice guide on getting started with Dino. Controlling an LED is not very exciting, sure. You get to be the creative one :)

class SiriProxy::Plugin::Arduino < SiriProxy::Plugin
  def initialize(config)
    #if you have custom configuration options, process them here!
    board =
    @led =, board: board)

  listen_for /light(s)? on/i do
    @led.send :on
    say "Light on"
    request_completed #always complete your request! Otherwise the phone will "spin" at the user!

  listen_for /light(s)? off/i do
    @led.send :off
    say "Light off"
    request_completed #always complete your request! Otherwise the phone will "spin" at the user!

Keep your eyes peeled for more posts, like a siri-enabled coffee maker and easy install instructions.

* In order to actually control your toaster, you would need to attach a relay to your Arduino. This will come later (in pt. 2 or pt. 3)

The Current State of Music

24 January 2013


That’s a Spotify royalty check. Sad, huh? Is this really what the music industry has turned into? I feel responsible, in a sense. Or at least I feel responsible for my generation (I’m 22 now).

See, my generation grew up without the notion that we had to pay to listen to music. We take the convenience of things like streaming music services for granted. We even made this a social norm across all age groups. The youngins (but not too young) grew up with Napster, Kazaa, and whatever other various websites and services have you. Digital delivery is just so much more convenient than physical media.

Who does this affect? What does the music industry hold in the future? Will artists be forced to rely on revenues from live shows? Sure, there are things like Bandcamp, but isn’t that yet another service, hoping to take their cut of revenues that an artist deserves? Or will artists give up on trying to make a living off music, and instead, freely distribute music? That’s unsustainable, in my eyes.

Especially considering that Spotify has been operating at a net loss. While this may be an outdated figure, they operated at a $57 million loss for 2011. Read more from the New York Times.

Spotify is batshit crazy! Quite honestly, how much longer can this sort of thing continue? Artists like Grizzly Bear can’t afford health insurance, and Cat Power struggled due to health problems. Read about Grizzly Bear and Cat Power.

So why do we continue to use Spotify if this sort of outcome is arguably a result of our increased usage of convenience services? For the sake of musicians, buy your music!

Boycott Spotify!


20 January 2013


2004 is the year that I first decided to build a website. I decided that vBulletin would be the backend for my site, so I acquired a copy online, perhaps less than legimiately. Seeing as I was fourteen years old at the time, I didn’t have an extra few hundred dollars lying around for a license. At the time, the primary way to add features to your site was to apply a “mod”, which was usually composed of adding a few php files, and LOTS of find & replace. Quite frankly, this may be the reason why I put down web development during my later tools. Script kiddie life sucks.

It was ahead of its time. This was during a a pre-Facebook era. I think that “Nico Ritschel Dot Com” perhaps even predated general Myspace use among my peers. At it’s peak, my 14 year old classmates had made well over 10,000 posts. I added flash games with competitive features (Thanks, vBulletin mod author!), and my 8th grade friends did their shit-talking on my site. In fact, there became too much shit-talking for me to moderate any longer, and I took down my prized website, at the request of the my middle school principal. Now, I wasn’t much of a trouble maker, so this really caught me off guard.

At one point, I even figured, why not add some Adsense ads? Now, I won’t speculate on the legitimacy of the clicks on those ads, but I eventually did receieve a $150 check from Google. I was excited that I actually made money online. I think I spent my winnings on a 120GB Western Digital Black drive (seems like nothing now, huh?). At the time, I was very interested in building computers, and things like fast hard drives tickled my fancy.

Now, things like Ruby and clean code tickle my fancy, thanks to a rich open source/hacker community that I call my own. I overcame that teenage fear, and now I rediscovered my passion. It took 9 years, but things have now come full circle, and I am glad that is back.

(However, I am running Twitter Bootstrap on top of Jekyll this time around)

New Blog

19 January 2013

Probably the best use of a Saturday in a while. I’m pretty proud of how my blog is turning out.


Perhaps I should tweet more. Hmm?


is my employer.

Get in touch

Email, skype, carrier pigeon, messenger owl...