Skip to content

Instantly share code, notes, and snippets.

@brodock
Last active December 29, 2015 15:49
Show Gist options
  • Save brodock/7693207 to your computer and use it in GitHub Desktop.
Save brodock/7693207 to your computer and use it in GitHub Desktop.
Setting update-alternatives for ubuntu as a way to change system ruby with compiled one
# update-alternative (install)
sudo update-alternatives --install /usr/bin/ruby ruby2.0 /opt/rubies/2.0.0-p353/bin/ruby 0
sudo update-alternatives --install /usr/bin/erb erb2.0 /opt/rubies/2.0.0-p353/bin/erb 0
sudo update-alternatives --install /usr/bin/gem gem2.0 /opt/rubies/2.0.0-p353/bin/gem 0
sudo update-alternatives --install /usr/bin/irb irb2.0 /opt/rubies/2.0.0-p353/bin/irb 0
sudo update-alternatives --install /usr/bin/rake rake2.0 /opt/rubies/2.0.0-p353/bin/rake 0
sudo update-alternatives --install /usr/bin/rdoc rdoc2.0 /opt/rubies/2.0.0-p353/bin/rdoc 0
sudo update-alternatives --install /usr/bin/ri ri2.0 /opt/rubies/2.0.0-p353/bin/ri 0
sudo update-alternatives --install /usr/bin/testrb testrb2.0 /opt/rubies/2.0.0-p353/bin/testrb 0
# update-alternatives (uninstall)
sudo update-alternatives --remove ruby2.0 /opt/rubies/2.0.0-p353/bin/ruby
sudo update-alternatives --remove erb2.0 /opt/rubies/2.0.0-p353/bin/erb
sudo update-alternatives --remove gem2.0 /opt/rubies/2.0.0-p353/bin/gem
sudo update-alternatives --remove irb2.0 /opt/rubies/2.0.0-p353/bin/irb
sudo update-alternatives --remove rake2.0 /opt/rubies/2.0.0-p353/bin/rake
sudo update-alternatives --remove rdoc2.0 /opt/rubies/2.0.0-p353/bin/rdoc
sudo update-alternatives --remove ri2.0 /opt/rubies/2.0.0-p353/bin/ri
sudo update-alternatives --remove testrb2.0 /opt/rubies/2.0.0-p353/bin/testrb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment