I am currently using ruby version 2.7.0 and I want to upgrade to version 3.1.0 in ubuntu 20:04. I have installed ruby 3.1.0 by following Install ruby 3 using rbenv. This is my output of command rbenv versions, seems the installation is completed.
peisen#peisen:~$ rbenv versions
* system (set by /home/peisen/.rbenv/version)
3.1.0
However, when i check my ruby version using ruby -v
peisen#peisen:~$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
It shows the version is still 2.7.0. I am still a beginner in ubuntu and not sure how to modify this. I followed this post but this did not work for me. Any ideas?
The output
peisen#peisen:~$ rbenv versions
* system (set by /home/peisen/.rbenv/version)
3.1.0
means that you have two versions installed, system Ruby and 3.1.0. The asterisk indicates that system Ruby is still the currently selected version.
To switch to Ruby 3.1.0 globally run:
$ rbenv global 3.1.0
See the docs about rbenv global and other options to set your desired Ruby version.
Related
I installed Ruby (v2.6.3) and Rails (v5.2.3).
Even completed a training project on this framework.
Then he took up a working project and first of all executed the command bundle install.
All modules were delivered normally, except one "sassc-2.0.1"
Installation fails with this error:
sassc-2.0.1 requires ruby version >= 2.3.3, which is incompatible with the current version, ruby 2.3.1p112
That is, I chose one version, and in fact uses a different version.
I can't understand the reason for this.
But I didn't give up the first time.
I tried to check the ruby version in different ways:
(1) Get ruby version
$> ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
(2) Get path to bin for ruby
$> which ruby
/home/vdenisov/.rvm/rubies/ruby-2.6.3/bin/ruby
(3) Get path to bin for bundle
$> which bundle
/home/vdenisov/.rvm/rubies/ruby-2.6.3/bin/bundle
All these commands give out that the current version of ruby is 2.6.3
However, my friend advised me to do one more check
(4) WTF ???
$> /usr/bin/ruby -v
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
P.S.: before that I programmed in nodejs and there is a version Manager "nvm" - when you run the command "nvm use a.b.c" in the system, always use the nodejs version of "a.b.c" (the same I expected from the "rvm").
/usr/bin/ruby -v gives you the version of ruby installed in your operating system.
It seems that you already run rvm use --default 2.6.3 because your ruby points to rvm location.
Ruby environment manager RVM supports configuration inside following files: .rvmrc, .versions.conf, .ruby-version, Gemfile. More here: https://rvm.io/workflow/projects
Check these files, it's good practice to set ruby version inside .ruby-version or Gemfile.
bundler gem orients on Ruby version, which locked in Gemfile.lock. Just change Ruby version in Gemfile (not .lock). Try 2.3.3 at first. Maybe you need to install it with rvm or rbenv.
I am using zsh and ruby version 2.3.1.
I would like to upgrade it to 2.5.0. I tried to install rvm and ruby version 2.5.0; they were installed, but it also caused many problems because it wasn't able to find other gems.
I removed rvm, and it was back to the way it used to be.
I was wondering if there's a way to upgrade ruby withour rvm. I don't know how ruby was installed before.
When I type which ruby, I get /Users/myname/.rbenv/shims/ruby
Looks like you are using rbenv to manage ruby versions. You can type the following command to install ruby 2.5.0
rbenv install 2.5.0
After that, change your default ruby version to 2.5.0 by typing
rbenv global 2.5.0
For more information and commands, check out the docs.
I"m using Ubuntu and RVM. I've run the command
rvm use 2.1.2
Running
ruby -v
gives me the 2.1.2 version.
When I start rails I get the following error
Your Ruby version is 2.3.1, but your Gemfile specified 2.1.2
But RVM doesn't even have 2.3.1 installed.
You may have apt installed ruby. For example, when I run apt show ruby, on my system, I get this
$ apt show ruby
Package: ruby
Version: 1:2.3.0+1
Priority: optional
Section: interpreters
Source: ruby-defaults
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
...
Clearly, the ruby version is 2.3.x here. So I suggest you apt remove ruby first. If that doesn't solve the problem, it is possible that there is a problem with your $PATH environment variable.
ruby -v gives you the ruby version installed on your system, not the current ruby version used by RVM.
To see which ruby version is currently used by RVM, use rvm list. Make sure it's using ruby version 2.1.2 by running rvm use ruby-2.1.2
From your question, it seems Rails is using your system ruby instead of RVM ruby.
I am on a Mac running OSX 10.11 El Capitan. I installed Ruby 2.3.1 via rvm. If I type in the terminal
ruby --version
It says that I am running 2.0.0
But if I type
rvm use 2.3.1
And then
ruby --version
It says that I am running 2.3.1
But next time I open terminal it goes back to 2.0.0
How can I use latest version of Ruby by default?
rvm --default use 2.3.1
Documentation here.
Make a .ruby-version file in a directory of your project and in it put ruby-3.2.1 or which ever version you want
Here is a question related to Ruby.
The Express Installation of OpenNebula 2.2.0 on CentOS has caused me big problems, since it installs Ruby 1.8.5, which is incompatible with Sunstone.
I installed Ruby 1.9.2 after executing the Express installation, but the problem remained, since Sunstone tried to use the old Ruby-installation.
I don't know how to configure, so that the newer Ruby-version should be used instead.
After this problem I reinstalled CentOS and installad Ruby 1.8.7.
When I do ruby -v, it shows:
ruby 1.8.7 (2010-12-23 patchlevel 330).
But when I do 'gem update –system', it says
(Gem::InstallError)
rubygems-update requries Ruby Version >= 1.8.7.. An older version was installed before from the CentOS-repository (for yum install) and apparently the GEM install doesn't understand that I have installed a newer version.
So my question is:
How should I configure my system so that all programs will understand to use Ruby 1.8.7 ?
Thanks!
Anders Branderud
I suggest to try using Ruby Version Manager
bash < <(curl -s https://rvm.ioinstall/rvm)
and then, or even better before :), read some documentation about rvm.