Step-by-step guide to setting up Ruby with Rbenv on Pop!_OS 22.04
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
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
Add rbenv to $PATH
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Apply changes to current session
List all possible Ruby versions
rbenv install --list-all
rbenv install 2.6.3
Set default version
rbenv global 2.6.3
Well-done. You did a great job!
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!