I am trying to install Ruby 2.7.7 via asdf but the latest version appears to be 2.7.6. Anyone happen to know how to support a new Ruby version on asdf?
Available Ruby 2.7.x versions
Tried installing Ruby 2.7.7, expected version to be available.
The asdf-ruby plugin uses ruby-build to actually build Ruby versions. To be able to install new Ruby versions, ruby-build needs to be updated.
You can set the desired ruby-build version by setting the ASDF_RUBY_BUILD_VERSION environment variable to the desired version before invoking asdf.
Alternatively, you can also update your asdf-ruby plugin to use the current ruby-build version on every invocation as they have updated the plugin to use the current ruby-build version by default in asdf-vm/asdf-ruby#317.
This can be done with either
asdf plugin update --all
or
asdf plugin update ruby
to just update the ruby plugin.
Related
I have been trying to install React Native into my Mac. In the installation docs, it requires Ruby version of 2.7.6 have been to be installed.
I have installed a new Ruby version using rbenv manager and it was successful. But now I cannot switch my machine to new Ruby version. Any help will be highly appreciated.
Thanks!
You have to set the version for the directory where your react project is. You can do this with:
rbenv local 2.7.6
This creates a file called .ruby-version in the directory, which tells rbenv what version of Ruby to use.
This is all visible in the README of rbenv.
You can have a look at this solution
Use the below command to change your ruby version:
rbenv global 3.1.2 # set the default Ruby version for this machine
# or:
rbenv local 3.1.2 # set the Ruby version for this directory
You can find this from rbenv Official Github Repo
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.
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 am trying to upgrade Ruby because I need to setup a Jekyll template, and I need to latest version to do it. Since I have a Mac running Sierra, I already have Ruby preinstalled as well as the Homebrew installation. When I install it using brew install ruby, it works, but when I check the version, it is still at 2.0.0 instead of 2.3.1 where it should be. Homebrew says I have 2.3.1, but the CLI says I have 2.0.0. I tried to use brew link --override ruby to make it work, but it said everything was working and it got me nowhere.
Use rbenv and plugin ruby-build. It will keep several versions of ruby on the one machine.
After install go to directory with your code, run rbenv install 2.3.1 and create file .ruby-version containing 2.3.1. All scripts running from this directory will use ruby 2.3.1.
Or you will able to set ruby version for all running scripts - rbenv global 2.3.1
My current Ruby version is 2.2.3 and I want to upgrade it to 2.3.0.
I use rbenv using this guide: gorails.com/setup/ubuntu/16.04
How do I upgrade my Ruby version? And when I upgrade, does it affect anything that I need to be aware of?
This answer had been written to address the original question, which did not specify rbenv as a preferred approach. Although the question changed after this answer was written, the answer has been retained to help users that may be using RVM to upgrade/manage their Ruby installations.
See the rbenv answer for details on using rbenv for the same purpose.
Use RVM or another Ruby version manager. This is far superior to installing a new system Ruby in most cases.
If you're upgrading your system Ruby, you have a number of things to keep in mind:
what other dependencies are there on that Ruby version?
are all of the gems going to be available after upgrade?
which applications are using the existing Ruby version and what can/will break after upgrade?
are there any other users using the existing Ruby that need to be aware of (and prepare for) the change?
With a Ruby version manager, you eliminate most of these concerns. You can run multiple Ruby versions on the same machine, which gives you the ability to test backward and forward compatibility. It also lets you experiment with the newer Ruby versions to make sure that they're fully stable for use.
You can install RVM using this method from any bash shell:
\curl -sSL https://get.rvm.io | bash -s stable
or update it to the most recent stable version by using:
rvm get stable
Once RVM is installed (or updated), you can install any Ruby version you choose, by doing the following:
rvm install 2.3.0
or upgrade from one version to another:
rvm upgrade 2.2.3 2.3.0
You can see which Ruby versions are installed by using this:
rvm list
You can also check to see which versions of Ruby that you can install on RVM by using this command:
rvm list known
Switch to a specific installed Ruby version by using the use command:
rvm use 2.3.0
and then switch back to an older version when you need to:
rvm use 2.2.3
Check out the RVM documentation for more features. You'll be surprised at how useful RVM actually is. There's a whole lot more to it than just what's shown here.
To upgrade your Ruby version using rbenv, you can use these steps. Some will only be necessary based on your environment. Plugins are an important aspect of this, if you have any installed.
Update rbenbv
First, you'll want to make sure that your rbenv version is updated. If you have the update plugin installed, you can update rbenv and all installed plugins using a single command:
rbenv update
Using the update plugin is highly recommended. However, if you are not using the update plugin, you can manually update rbenv in this way:
cd ~/.rbenv
git pull
Update plugins
If you have manually updated rbenv, you'll also need to update the plugins manually, as well. Make sure to follow the update instructions for each plugin.
One plugin that's very important to update at this point (if you have it installed) is the ruby-build plugin, which provides build support for Ruby under rbenv. This may improve the experience installing a new Ruby version in the next step.
Install Ruby version
After you have updated rbenv, you can install the new Ruby version:
rbenv install -v 2.3.0
Remove Ruby version
rbenv will allow you to manage and use multiple Ruby versions on a single machine. This is a huge benefit. However, if you no longer want the older Ruby version installed, you can remove it like this:
rbenv uninstall 2.2.3
Note that you can always re-install the Ruby version after uninstalling it, and use rbenv to manage the versions separately. This is good practice when working with multiple projects.