How to install Ruby on Linux
Before installing, you can check if Ruby is already installed in the system by running the following command in the terminal:
which ruby
Ruby is already installed if the output shows a path as usr/bin/ruby/. If an error message is displayed instead, Ruby is not installed.
Installing Ruby
The easiest way to install Ruby on Linux-based systems is through the apt package manager, by running commands in the terminal. The steps involved are as follows:
Step 1
Update the packages index by running the following command in the terminal:
sudo apt update
Step 2
Install Ruby by typing the following command in the terminal:
sudo apt install ruby-full
Step 3
To verify that Ruby has been installed successfully, run the following command:
ruby --version
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved