Ruby is installed on most Linux distributions by default. However, you can follow the steps below to determine if Ruby is installed and, if not, install the Ruby interpreter on your Linux computer.

How to Install Ruby on Linux

For an Ubuntu-based distribution, follow the following procedure to verify whether you have Ruby installed, and if not, to install it.

  1. Open a terminal window. One way open the terminal window (sometimes called a "shell" or "bash shell") is to select Applications Accessories Terminal.
  2. Run the command which ruby. If you see a path such as /usr/bin/ruby, Ruby is installed. If you don't see any response or get an error message, Ruby is not installed.
  3. To verify that you have a current version of Ruby, run the command ruby -v.
  4. Compare the version number returned with the version number on the Ruby download page.These numbers don't have to be exact, but if you are running a version that's too old, some of the features may not work correctly.
  5. Install appropriate Ruby packages. This process differs between distributions, but on Ubuntu run the following comman


sudo apt-get install ruby-full


Verify That Ruby Works Correctly

Open a text editor and save the following as test.rb.


ruby puts "Hello world!"

In the terminal window, change directory to the directory where you saved test.rb. Run the command

chmod +x test.rb

, then run the command


You should see the message Hello world! displayed if Ruby is installed correctly


Subscribe For Daily Updates