Complete Ruby Installation Guide for Beginners

Welcome to the world of Ruby programming! This comprehensive guide will walk you through installing Ruby 3.x on Windows 11, macOS 13+, and modern Linux distributions. Ruby is a beautiful, expressive programming language that's perfect for beginners and professionals alike.

Table of Contents

Introduction

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. Before we begin, make sure you have administrator privileges on your computer.

What you'll learn:

  • Install Ruby 3.x on your operating system
  • Set up development tools
  • Verify your installation
  • Choose and configure a code editor
  • Run your first Ruby code

Windows Installation

  1. Download RubyInstaller

    • Visit RubyInstaller Downloads
    • Download Ruby+Devkit 3.x.x-x64 (latest 3.x version)
    • Choose the version with Devkit included
  2. Run the Installer

    • Double-click the downloaded .exe file
    • Accept the license agreement
    • Important: Check "Add Ruby executables to your PATH"
    • Check "Associate .rb and .rbw files with Ruby"
    • Click "Install"
  3. Install MSYS2 Development Toolchain

    • After Ruby installation, MSYS2 setup will appear
    • Choose option 3 (install all components)
    • Wait for the installation to complete
  4. Verify Windows Installation

    ruby -v
    gem -v
    

Method 2: Windows Subsystem for Linux (WSL)

For advanced users who prefer Linux environment on Windows:

  1. Enable WSL

    wsl --install
    
  2. Install Ubuntu and follow Linux instructions below

macOS Installation

  1. Install Homebrew (if not already installed)

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. Install rbenv and ruby-build

    brew install rbenv ruby-build
    
  3. Set up rbenv in your shell

    echo 'eval "$(rbenv init -)"' >> ~/.zshrc
    source ~/.zshrc
    
  4. Install Ruby 3.x

    rbenv install 3.3.0  # Use latest 3.x version
    rbenv global 3.3.0
    
  5. Verify rbenv installation

    rbenv versions
    ruby -v
    

Method 2: asdf (Alternative)

  1. Install asdf

    brew install asdf
    echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ~/.zshrc
    source ~/.zshrc
    
  2. Install Ruby plugin and Ruby

    asdf plugin add ruby
    asdf install ruby latest
    asdf global ruby latest
    

Method 3: RVM (Ruby Version Manager)

  1. Install RVM

    \curl -sSL https://get.rvm.io | bash -s stable
    source ~/.rvm/scripts/rvm
    
  2. Install Ruby

    rvm install 3.3.0
    rvm use 3.3.0 --default
    

Linux Installation

Ubuntu/Debian (22.04+)

  1. Update package manager

    sudo apt update
    sudo apt upgrade -y
    
  2. Install dependencies

    sudo apt install -y git curl libssl-dev libreadline-dev zlib1g-dev \
    autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev \
    libffi-dev libgdbm-dev libdb-dev
    
  3. Install rbenv (Recommended)

    git clone https://github.com/rbenv/rbenv.git ~/.rbenv
    echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(rbenv init -)"' >> ~/.bashrc
    source ~/.bashrc
    
  4. Install ruby-build

    git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
    
  5. Install Ruby 3.x

    rbenv install 3.3.0
    rbenv global 3.3.0
    

Fedora/RHEL (36+)

  1. Install dependencies

    sudo dnf install -y git curl gcc bison libffi-devel libyaml-devel \
    make autoconf automake libtool readline-devel openssl-devel
    
  2. Install rbenv and Ruby (follow steps 3-5 from Ubuntu section)

Arch Linux

  1. Install from official repositories

    sudo pacman -S ruby
    
  2. Or install rbenv from AUR

    yay -S rbenv ruby-build
    

Verification Steps

After installation, verify everything is working:

  1. Check Ruby version

    ruby -v
    # Should show: ruby 3.x.x
    
  2. Check gem manager

    gem -v
    
  3. Check bundler

    gem install bundler
    bundle -v
    
  4. Create a test file

    # test.rb
    puts "Hello, Ruby!"
    puts "Ruby version: #{RUBY_VERSION}"
    
  5. Run the test

    ruby test.rb
    

Code Editors

  1. Download and install VS Code

  2. Install Ruby extensions

    • Ruby (by Peng Lv)
    • Ruby Solargraph (for autocompletion)
    • VSCode Ruby (by Stafford Brunk)
  3. Configure VS Code

    • Open Command Palette (Ctrl/Cmd + Shift + P)
    • Type "Ruby: Configure"
    • Select your Ruby version

Sublime Text

  1. Download Sublime Text

  2. Install Package Control

  3. Install Ruby packages

    • RubyTest
    • SublimeLinter-ruby
    • Ruby Enhanced

Interactive Ruby (IRB)

IRB is Ruby's interactive shell. Try these commands:

  1. Start IRB

    irb
    
  2. Basic Ruby expressions

    puts "Hello, World!"
    2 + 2
    "Ruby is awesome!".upcase
    
  3. Exit IRB

    exit
    

Troubleshooting

Common Issues

1. "ruby: command not found"

  • Ensure Ruby is in your PATH
  • Restart your terminal/command prompt
  • Check installation steps again

2. "Permission denied" errors

  • Don't use sudo gem install
  • Use rbenv/rvm to manage Ruby versions
  • Check file permissions

3. Windows: "MSYS2 installation failed"

  • Install Visual Studio Build Tools
  • Run installer as Administrator
  • Disable antivirus temporarily

4. macOS: "Xcode Command Line Tools required"

xcode-select --install

5. SSL certificate errors

# Update certificates
gem update --system

Getting Help

  • Ruby Documentation: ruby-doc.org
  • Ruby Community: ruby-lang.org
  • Stack Overflow: Tag your questions with "ruby"
  • Reddit: r/ruby

Next Steps

Congratulations! You now have Ruby installed. Here's what to do next:

  1. Learn Ruby basics with Ruby in Twenty Minutes
  2. Try Ruby online at Try Ruby
  3. Build your first project - maybe a simple calculator or to-do list
  4. Join the community and start contributing to open source

Remember: Programming is a journey, not a destination. Take your time, practice regularly, and don't hesitate to ask for help. Welcome to the wonderful world of Ruby programming! 🎉


This guide is maintained by the Ruby community. Last updated: March 2026