Your cart is currently empty!
How to Install Ruby on Linux
Ruby is a dynamic, open-source programming language with a strong community and plenty of real-world use. If you’re getting into web development, automation, or scripting, Ruby is a great skill to have. Here’s how to install Ruby on Linux in a few straightforward steps.
Method 1: Install Ruby Using Your Linux Package Manager
This is the quickest way to get Ruby up and running, but you might not get the absolute latest version.
For Ubuntu/Debian:
sudo apt update
sudo apt install ruby-fullFor Fedora:
sudo dnf install rubyFor CentOS/RHEL:
sudo yum install rubyAfter installation, check your Ruby version:
ruby -vMethod 2: Install Ruby Using a Version Manager
If you want more control—especially if you need multiple Ruby versions—use a version manager like RVM or rbenv.
Install Ruby with RVM
- Install GPG Keys:
sudo apt updatesudo apt install curl gpgcurl -sSL https://rvm.io/mpapis.asc | gpg --import -curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - - Install RVM:
curl -sSL https://get.rvm.io | bash -s stablesource ~/.rvm/scripts/rvm - Install Ruby:
rvm install rubyrvm use ruby --default - Verify Installation:
ruby -v
Install Ruby with rbenv
- Install dependencies:
sudo apt updatesudo apt install git curl libssl-dev libreadline-dev zlib1g-dev - Install rbenv and ruby-build:
git clone https://github.com/rbenv/rbenv.git ~/.rbenvcd ~/.rbenv && src/configure && make -C srcecho 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrcecho 'eval "$(rbenv init -)"' >> ~/.bashrcsource ~/.bashrcgit clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build - Install Ruby:
rbenv install 3.3.0 # Replace with latest versionrbenv global 3.3.0 - Check Version:
ruby -v
Troubleshooting
- If the terminal says
ruby: command not found, close and reopen your terminal or runsource ~/.bashrc. - If installation fails, check for missing dependencies and install them using your package manager.
- For Ubuntu, always run
sudo apt updatebefore installing new packages.
Wrapping Up
That’s it! You’ve got Ruby running on your Linux machine. Whether you use your package manager or a version manager, you’re now set up to start developing with Ruby. If you hit any issues, check the official Ruby documentation for deeper troubleshooting.
Ready to code? Fire up IRB with irb and start experimenting!

Tech enthusiast and content creator passionate about making technology simple for everyone. I share practical tips, guides, and reviews on the latest in computers, software, and gadgets. Let’s explore the digital world together!
