Easily switch between Ruby 1.8.6 and 1.9.1
Chad mentioned that he'd gotten ruby 1.9.1 and 1.8.6 side by side on his workstation (his code for this is in his awesome spicy-config repo).
I took some time this morning to get a similar setup working. Now, on my prompt, I type, use_ruby_186 or use_ruby_191 to go back and forth between the Ruby 1.8.6 shipped with Leopard and a self-compiled install of ruby 1.9.1.
Steps for you to get there:
- Compile and install ruby 1.9.1:
mkdir -p ~/tmp cd ~/tmp curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz tar xzf ruby-1.9.1-p0.tar.gz cd ruby-1.9.1-p0 ./configure --prefix=$HOME/.ruby_versions/ruby_191 make make install
- Install the ruby switcher:
curl -L http://github.com/relevance/etc/tree/master%2Fbash%2Fruby_switcher.sh?raw=true?raw=true > ~/ruby_switcher.sh echo "source ~/ruby_switcher.sh" >> ~/.bash_profile
Note that I use ~/.gem for my gems. If you don't do that, you'll have to modify the switcher to specify your GEM_HOME. Type gem env and look for GEM PATHS to figure out what you should set it to.

1 comments:
I just install both side by side: http://tr.im/gFJN?github
Post a Comment