Skip to content

Instantly share code, notes, and snippets.

@marcjeanson
Created December 19, 2022 15:02
Show Gist options
  • Save marcjeanson/0ab493c9c16661fcfb2445299a206793 to your computer and use it in GitHub Desktop.
Save marcjeanson/0ab493c9c16661fcfb2445299a206793 to your computer and use it in GitHub Desktop.
update-alternatives for Ruby
# I had an existing ruby2.7 installed with the brightbox packages, add it to update-alternatives:
update-alternatives \
--install /usr/bin/ruby ruby /usr/bin/ruby2.7 60 \
--slave /usr/bin/gem gem /usr/bin/gem2.7 \
--slave /usr/bin/bundle bundle /usr/bin/bundle2.7 \
--slave /usr/bin/erb erb /usr/bin/erb2.7 \
--slave /usr/bin/irb irb /usr/bin/irb2.7 \
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc2.7 \
--slave /usr/bin/ri ri /usr/bin/ri2.7
# I installed ruby 3.1 using ruby-install to /opt/rubies. Adding it to update-alternatives:
update-alternatives \
--install /usr/bin/ruby ruby /opt/rubies/ruby-3.1.3/bin/ruby 50 \
--slave /usr/bin/gem gem /opt/rubies/ruby-3.1.3/bin/gem \
--slave /usr/bin/bundle bundle /opt/rubies/ruby-3.1.3/bin/bundle \
--slave /usr/bin/erb erb /opt/rubies/ruby-3.1.3/bin/erb \
--slave /usr/bin/irb irb /opt/rubies/ruby-3.1.3/bin/irb \
--slave /usr/bin/rdoc rdoc /opt/rubies/ruby-3.1.3/bin/rdoc \
--slave /usr/bin/ri ri /opt/rubies/ruby-3.1.3/bin/ri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment