9/14/08
Need to run Ruby 1.9 while preserving Ruby 1.8?
I recently decided to start building some production apps using Ruby 1.9. I figured it's getting close enough to full release so why not? Of course the majority of my work still uses Ruby 1.8. So I thought I would jot down some quick notes on how to run them in a non-destructive way. I borrowed the install from this thread [ http://bparanj.blogspot.com/2008/03/installing-ruby-19-on-mac-os-x-with.html?showComment=1218160020000#c441013345691275251 ].
After changing the "/Users/balaparanj/" portions to your own directory, be it your home or otherwise, and compiling all of it, I wrote the following script to easily switch between the two versions as needed:
Just chmod it and your ready to go.
Now the script assumes a lot of things, like using macports on OS X 10.5 Leopard. Just adjust as needed. Don't forget to change the appropriate areas or it won't work.
After changing the "/Users/balaparanj/" portions to your own directory, be it your home or otherwise, and compiling all of it, I wrote the following script to easily switch between the two versions as needed:
#!/usr/bin/env ruby
# Usage: sudo ./use_ruby_version.rb 1.9
`rm -f /opt/local/bin/ruby`
case ARGV[0].to_s
when "1.8"
`ln -s /opt/local/bin/ruby1.8 /opt/local/bin/ruby`
when "1.9"
`ln -s /your_ruby1.9_path/ruby19/bin/ruby /opt/local/bin/ruby`
else
`ln -s /opt/local/bin/ruby1.8 /opt/local/bin/ruby`
end
Just chmod it and your ready to go.
chmod 755 use_ruby_version.rb
Now the script assumes a lot of things, like using macports on OS X 10.5 Leopard. Just adjust as needed. Don't forget to change the appropriate areas or it won't work.
Labels: ruby



2 Comments:
At September 30, 2008 3:43 AM ,
Anonymous said...
At September 30, 2008 8:00 AM ,
w3bsmith said...
Links to this post:
Create a Link
<< Home