Step-by-step guide to setting up Ruby with Rbenv on Pop!_OS 22.04

Rbenv
rbenv is a lightweight Ruby version management tool. It allows you to easily install, manage, and switch between different versions of Ruby on your system.
This is particularly useful for developers who may need to work on projects that require different Ruby versions or need to keep their development environment in sync with specific Ruby versions.
With rbenv, you can set a Ruby version on a per-project basis, ensuring that each project uses the appropriate version of Ruby.
This helps in avoiding conflicts between projects that might require different Ruby versions and ensures consistency across your development environment.
Update your OS
sudo apt update
Install the dependencies
sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev
Install rbenv
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
Output

Add rbenv to $PATH
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
Output

Load rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Output

Apply changes to current session
source ~/.bashrc
Output

Verify installation
type rbenv
Output

List all possible Ruby versions
rbenv install --list-all
Output

Install ruby
rbenv install 2.6.3
Output

Set default version
rbenv global 2.6.3
ruby -v
Done
Celebrate
Well-done. You did a great job!

Let's network
Final thoughts
Thank you for reading this article.
If you have any questions, thoughts, suggestions, or corrections, please share them with us.
We appreciate your feedback and look forward to hearing from you.
Feel free to suggest topics for future blog articles. Until next time!




