How can I upgrade Ruby version from 3.2.2 to 3.3.0 using asdf?

1.2k Views Asked by At

I am currently using Ruby version 3.2.2 on Ubuntu 22.04, which I installed using asdf. I would like to upgrade to version 3.3.0.

When I run asdf install ruby 3.3.0, I keep getting the error message ruby-build: definition not found: 3.3.0.

Can anyone guide me on how to upgrade my Ruby version to 3.3.0 using asdf?

I have tried running asdf install ruby 3.3.0 where I expected it to upgrade my version to Ruby 3.3.0.

3

There are 3 best solutions below

0
Dennis Kamau On

Updating asdf plugin using the following command asdf plugin update ruby has worked for me. You should be able to install 3.3.0 afterwards.

1
Dogweather On

Here's how I do it using devops to make my version predictable:

  1. I update all the languages I use, because why not? You'll see which ones get a new version to install:
$ asdf plugin update --all
  1. I look and see what versions of Ruby are available. And hey! Ruby 3.3.0 is there:
$ asdf list all ruby
  1. Then, to keep things sane and devops, I edit the Ruby entry in whatever project I want to use it. Or, maybe I'll just make it the default for my user account:
$ vi ~/.tool-versions

This opens up my current defaults, which I edit to change the ruby line:

elixir 1.16.0-otp-26
erlang 26.1.2
gleam  0.33.0
python 3.12.1
ruby   3.3.0
  1. For the last step, I install the new version the easy way. This looks at the nearest .tool-versions and installs them:
$ asdf install

You can verify you're running the new version like this:

$ ruby -v                                                                                   
Could not locate Gemfile or .bundle/ directory
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]

Finally, this isn't required, but I always update the essentials when I install a new interpreter:

$ gem update --system ; gem update bundler
0
Rizwan Basharat Ali On

You can do it by using rvm and arch: Just follow these steps:

1.First Uninstall existing Homebrew arch -arm64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

2.Then remove the homebrew folder

sudo rm -rf /opt/homebrew

3.It will reinstall homebrew

arch -arm64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 

4.Now install the ruby 3.3.0, It will install with all required binaries

arch -arm64 rvm install 3.3.0

5.Use this to see available ruby versions

rvm list 

6.Then just run

rvm use 3.3.0

NOTE: These steps always worked for me to have different ruby versions and i can select the desired one easily