Skip to content

Instantly share code, notes, and snippets.

@michaelwclark
Created November 16, 2012 21:57
Show Gist options
  • Select an option

  • Save michaelwclark/4091266 to your computer and use it in GitHub Desktop.

Select an option

Save michaelwclark/4091266 to your computer and use it in GitHub Desktop.
Command line command for getting current active version of Ruby. Tested on OSX 10.8.2 w/ zsh and iTerm2. RVM + iTerm = headaches. Hopefully this helps someone else out there..
#!/bin/bash -e
echo `ruby -v | sed 's/(.*//g' | sed 's/ruby//g' |sed 's/ //g' |sed 's/[ \t]*$//'`
# I realized after spending about 30 minutes on building up this command for my zsh Prompt that
# rvm_ruby_string contains the same thing.
# However, the reason I added this to my prompt is RVM kept giving me problems with not switching from OSX inbuilt ruby to the
# current environment...so adding an indicator always helps.
# I'm going to write a small shell script to fix the non-auto switching of RVM ruby versions with iTerm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment