Science, Tech, Math › Computer Science How to Install Ruby on Linux Easy Steps to Install Ruby on Linux Share Flipboard Email Print mihailomilovanovic/Getty Images Computer Science Ruby Programming PHP Programming Perl Python Java Programming Javascript Programming Delphi Programming C & C++ Programming Visual Basic View More By Michael Morin Michael Morin Computer Science Expert Michael Morin is a computer programmer specializing in Linux and Ruby. He has 30 years of experience studying, teaching and using the programming language. Learn about our Editorial Process Updated on October 14, 2018 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. Open a terminal window. One way open the terminal window (sometimes called a "shell" or "bash shell") is to select Applications > Accessories > Terminal. 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. To verify that you have a current version of Ruby, run the command ruby -v. 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. Install appropriate Ruby packages. This process differs between distributions, but on Ubuntu run the following command:sudo apt-get install ruby-full Verify That Ruby Works Correctly Open a text editor and save the following as test.rb. #!/usr/bin/env rubyputs "Hello world!" In the terminal window, change directory to the directory where you saved test.rb. Run the commandchmod +x test.rb, then run the command ./test.rb You should see the message Hello world! displayed if Ruby is installed correctly. Tips: Every distribution is different. Refer to your distribution's documentation and community forums for help installing Ruby on distributions other than Ubuntu or its variants. For distributions other than Ubuntu, if your distribution doesn't provide a tool like apt-get then you can use a site such as RPMFind to find Ruby packages. Look for the irb, ri and rdoc packages as well, but depending on how the RPM package was built, it may already include these programs. Cite this Article Format mla apa chicago Your Citation Morin, Michael. "How to Install Ruby on Linux." ThoughtCo, Aug. 26, 2020, thoughtco.com/instal-ruby-on-linux-2908370. Morin, Michael. (2020, August 26). How to Install Ruby on Linux. Retrieved from https://www.thoughtco.com/instal-ruby-on-linux-2908370 Morin, Michael. "How to Install Ruby on Linux." ThoughtCo. https://www.thoughtco.com/instal-ruby-on-linux-2908370 (accessed June 10, 2023). copy citation