·  Chris Hammond   
 Last Updated   
How to Upgrade Ruby on Ubuntu 22.04 Using rbenv
Instructions for how to upgrade Ruby on Ubuntu 22.04 Using rbenv to allow for having multiple versions of Ruby installed.
 
 How to Upgrade Ruby on Ubuntu 22.04 Using rbenv
Upgrading Ruby on Ubuntu can be smoothly handled with a version manager like rbenv. This approach is not only efficient but it also allows for easy switching between different Ruby versions. Below is a step-by-step guide on installing rbenv and using it to upgrade Ruby to your desired version.
Installing rbenv and Ruby-build
Follow these steps to set up rbenv and ruby-build on your system:
- Install rbenv and ruby-build: This step involves pulling rbenvand its pluginruby-buildfrom GitHub, which helps in managing multiple Ruby versions.sudo apt update sudo apt install -y git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer | bash
- Configure rbenv integration: Add rbenvto your shell to enable shims and autocompletion by appending the following lines to your shell configuration file.
 If you useecho 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc exec $SHELLzsh, replace.bashrcwith.zshrc.
- Check the rbenv installation: Ensure that rbenvis integrated correctly into your shell.
 This command should output "rbenv is a function".type rbenv
Once rbenv is set up, proceed to install a new Ruby version:
- List all available versions of Ruby:
   
 Look for the latest stable versions or any specific version you wish to install.rbenv install -l
- Install Ruby:     
If Ruby 3.2.3 or another version like 3.3 is available, install it using:
 rbenv install 3.2.3 # Replace 3.2.3 with the desired version rbenv global 3.2.3 # Set the installed version as the default
- Verify the installed Ruby version:
   ruby -vThis command will display the Ruby version you have set as default, confirming the successful installation. 
 Chris Hammond
Chris Hammond  
  
  
 