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
- Windows Installation
- macOS Installation
- Linux Installation
- Verification Steps
- Code Editors
- Interactive Ruby (IRB)
- Troubleshooting
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
Method 1: RubyInstaller (Recommended for Windows 11/10)
Download RubyInstaller
- Visit RubyInstaller Downloads
- Download Ruby+Devkit 3.x.x-x64 (latest 3.x version)
- Choose the version with Devkit included
Run the Installer
- Double-click the downloaded
.exefile - Accept the license agreement
- Important: Check "Add Ruby executables to your PATH"
- Check "Associate .rb and .rbw files with Ruby"
- Click "Install"
- Double-click the downloaded
Install MSYS2 Development Toolchain
- After Ruby installation, MSYS2 setup will appear
- Choose option 3 (install all components)
- Wait for the installation to complete
Verify Windows Installation
ruby -v gem -v
Method 2: Windows Subsystem for Linux (WSL)
For advanced users who prefer Linux environment on Windows:
Enable WSL
wsl --installInstall Ubuntu and follow Linux instructions below
macOS Installation
Method 1: rbenv (Recommended for macOS 13+)
Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install rbenv and ruby-build
brew install rbenv ruby-buildSet up rbenv in your shell
echo 'eval "$(rbenv init -)"' >> ~/.zshrc source ~/.zshrcInstall Ruby 3.x
rbenv install 3.3.0 # Use latest 3.x version rbenv global 3.3.0Verify rbenv installation
rbenv versions ruby -v
Method 2: asdf (Alternative)
Install asdf
brew install asdf echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ~/.zshrc source ~/.zshrcInstall Ruby plugin and Ruby
asdf plugin add ruby asdf install ruby latest asdf global ruby latest
Method 3: RVM (Ruby Version Manager)
Install RVM
\curl -sSL https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvmInstall Ruby
rvm install 3.3.0 rvm use 3.3.0 --default
Linux Installation
Ubuntu/Debian (22.04+)
Update package manager
sudo apt update sudo apt upgrade -yInstall 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-devInstall 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 ~/.bashrcInstall ruby-build
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-buildInstall Ruby 3.x
rbenv install 3.3.0 rbenv global 3.3.0
Fedora/RHEL (36+)
Install dependencies
sudo dnf install -y git curl gcc bison libffi-devel libyaml-devel \ make autoconf automake libtool readline-devel openssl-develInstall rbenv and Ruby (follow steps 3-5 from Ubuntu section)
Arch Linux
Install from official repositories
sudo pacman -S rubyOr install rbenv from AUR
yay -S rbenv ruby-build
Verification Steps
After installation, verify everything is working:
Check Ruby version
ruby -v # Should show: ruby 3.x.xCheck gem manager
gem -vCheck bundler
gem install bundler bundle -vCreate a test file
# test.rb puts "Hello, Ruby!" puts "Ruby version: #{RUBY_VERSION}"Run the test
ruby test.rb
Code Editors
Visual Studio Code (Recommended)
Download and install VS Code
Install Ruby extensions
- Ruby (by Peng Lv)
- Ruby Solargraph (for autocompletion)
- VSCode Ruby (by Stafford Brunk)
Configure VS Code
- Open Command Palette (Ctrl/Cmd + Shift + P)
- Type "Ruby: Configure"
- Select your Ruby version
Sublime Text
Download Sublime Text
Install Package Control
- Open Sublime Text
- Install Package Control from packagecontrol.io
Install Ruby packages
- RubyTest
- SublimeLinter-ruby
- Ruby Enhanced
Interactive Ruby (IRB)
IRB is Ruby's interactive shell. Try these commands:
Start IRB
irbBasic Ruby expressions
puts "Hello, World!" 2 + 2 "Ruby is awesome!".upcaseExit 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:
- Learn Ruby basics with Ruby in Twenty Minutes
- Try Ruby online at Try Ruby
- Build your first project - maybe a simple calculator or to-do list
- 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