Skip to content

Can this be used with update-alternatives? #445

Closed

Description

@lacostenycoder

I'm trying to use Ruby 2.7.7 on a server which is still running Ubuntu 16.04. I'm able to use ruby-install to install that version, however I can't seem to configure update-alternatives to work in order to have the Ruby version configured system wide. I tried with chruby but that didn't seem to work. Running any rake commands gave error on which version should have been running, it keeps falling back to 2.6.6.

 sudo update-alternatives --list ruby
/usr/bin/ruby2.3
/usr/bin/ruby2.6

I had tried some things that left things in this state. It was probably trying to force this to work with

sudo update-alternatives --install /usr/bin/ruby ruby /opt/rubies/ruby-2.7.7/bin/ruby 100

The errors described above remained so I did

sudo update-alternatives --remove ruby /opt/rubies/ruby-2.7.7/bin/ruby

This is current state of things, but config has been set back to 2.6.6 to not break things for now.

sudo update-alternatives --get-selections | grep ruby
ruby                           manual   /usr/bin/ruby2.6
ruby2.7                        auto     /opt/rubies/ruby-2.7.7
ruby2.7.7                      auto     /etc/alternatives/ruby

I guess I don't have a clear enough understanding of update-alternatives but wondered if anyone here has used it successfully with ruby-install. Using apt install ruby2.7 will only install 2.7.1

Activity

  1. changed the title [-]Can this be used with update-alternatives[/-] [+]Can this be used with update-alternatives?[/+] on Mar 14, 2023
  2. postmodern commented on Jun 23, 2023

    @postmodern
    Owner

    Try running ruby-install --system ruby 2.7.7 which will install it globally into /usr/local. This should then implicitly override /usr/bin/ruby for regular users; because /usr/local/bin comes before /usr/bin in the PATH env variable.

  3. Repository owner locked and limited conversation to collaborators on Jun 23, 2023
  4. converted this issue into a discussion #455 on Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions