Skip to content

Instantly share code, notes, and snippets.

@wmoxam
Created January 6, 2012 05:05
Show Gist options
  • Save wmoxam/1569088 to your computer and use it in GitHub Desktop.
Save wmoxam/1569088 to your computer and use it in GitHub Desktop.
Ubuntu Way of managing Rubies
# Installs Ruby, makes 1.9.2 the default.
sudo aptitude install ruby rubygems ri ruby1.9.1 ri1.9.1 jruby
sudo update-alternatives --remove-all gem
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.8 300 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/ruby1.8.1.gz \
--slave /usr/bin/ri ri /usr/bin/ri1.8 \
--slave /usr/bin/irb irb /usr/bin/irb1.8 \
--slave /usr/bin/gem gem /usr/bin/gem1.8
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/ruby1.9.1.1.gz \
--slave /usr/bin/ri ri /usr/bin/ri1.9.1 \
--slave /usr/bin/irb irb /usr/bin/irb1.9.1 \
--slave /usr/bin/gem gem /usr/bin/gem1.9.1
sudo sh -c 'echo "#!/bin/sh\n/usr/bin/jruby -S ri \$*" > /usr/bin/jrubyri'
sudo sh -c 'echo "#!/bin/sh\n/usr/bin/jruby -S gem \$*" > /usr/bin/jrubygem'
sudo chmod +x /usr/bin/jrubyri
sudo chmod +x /usr/bin/jrubygem
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/jruby 200 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/jruby.1.gz \
--slave /usr/bin/ri ri /usr/bin/jrubyri \
--slave /usr/bin/irb irb /usr/bin/jirb \
--slave /usr/bin/gem gem /usr/bin/jrubygem
sudo update-alternatives --config ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment