Install Ruby and check the version

Contents
Install on Linux
ruby -v
Version managers
Your first gem command

Install on Linux

On Debian and Ubuntu one package is enough for this course. Update the package list first, then install Ruby.

Update the package list

sudo apt update

Install Ruby

sudo apt install ruby

The package manager may install a slightly older Ruby than the newest release. That is fine for this course: every example works on Ruby 3.0 and newer.

ruby -v

Check what was installed with one short command:

Show the installed Ruby version

ruby -v

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

You will see the word ruby followed by the version number and build details. If the terminal answers command not found, the install step above did not finish.

Version managers

Later you may need several Ruby versions on one machine, for example an old project and a new one side by side. Version managers such as rbenv and rvm install Rubies into your home folder and switch between them per project.

You do not need a manager for this course, but it helps to recognize the command that lists installed versions:

List Rubies known to rbenv

rbenv versions

system
3.2.2

Your first gem command

Ruby ships with a tool called gem that installs shared libraries. Check that it works alongside Ruby:

Show the installed gem version

gem --version

3.4.10

Later lessons will use gem to add libraries such as test frameworks. For now the version number alone proves that the toolchain is ready.

Next: irb: the interactive shell

Article author: Arthur Isaev

Related articles
Ruby
Ruby course: zero to hero in 50 lessons
What is Ruby and where it runs
Install Ruby and check the version
irb: the interactive shell
Your first Ruby script
Variables
Numbers
Strings
Symbols
Truthiness: only false and nil
Conditions
Loops
Arrays
Hashes
Ranges
Methods
Blocks, procs, lambdas
String tools
Files and IO
Exceptions
Modules and mixins
Classes and objects
Inheritance
Enumerables
Duck typing and core idioms
Gems and Bundler
Testing with Minitest
Debugging
Encodings
Time and date
JSON and YAML
HTTP clients
Sockets
REST APIs
puts, print and p
Metaprogramming
Enumerators
Pattern matching
Arguments: splats and kwargs
Rake tasks
Environment and CLI
Logging
CSV
ERB templates
WEBrick server
Rails in one lesson
Capstone: todo CLI
Capstone: JSON API
Performance
Modern Ruby tour
Hero roadmap: the whole course on one page
Install Ruby on Windows 11
Install Ruby on Ubuntu
Install Ruby on Rocky Linux
Install Ruby on macOS
Install Ruby on FreeBSD
Ruby in Docker
Threads and fibers

Search this site

Channel @aofeed Chat @aofeedchat

Contacts and cooperation:
I recommend our hosting beget.com
Write to info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: