RubyLearning

Helping Ruby Programmers become Awesome!

Ruby Installation

What is Ruby?

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.

Ruby was created by Yukihiro "Matz" Matsumoto in Japan in 1995. Matz designed Ruby to be fun to use and optimized for programmer happiness.

Downloading Ruby

Ruby can be installed on various operating systems. Here are the recommended ways to install Ruby:

Windows

Use RubyInstaller for Windows. It includes Ruby, a set of useful gems, and the DevKit for compiling native extensions.

macOS

macOS comes with Ruby pre-installed, but it's recommended to use a version manager like rbenv or RVM.


# Install rbenv with Homebrew
brew install rbenv ruby-build

# Install Ruby
rbenv install 3.2.0
rbenv global 3.2.0
          

Linux

Use your distribution's package manager or a version manager:


# Ubuntu/Debian
sudo apt-get install ruby-full

# Or use rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
          

Verifying Your Installation

After installation, open a terminal or command prompt and run:


ruby -v
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-darwin21]
      

Choosing an Editor

You can write Ruby code in any text editor. Some popular choices include:

  • Visual Studio Code - Free, with excellent Ruby extensions
  • RubyMine - Full-featured IDE by JetBrains
  • Sublime Text - Fast and lightweight
  • Vim/Neovim - For terminal enthusiasts

Tip: Set your editor to use 2 spaces for indentation. This is the Ruby community standard.