← Back to Ruby Course | Chapter 1: Setup & Basics | Lesson 2 of 7

Installing Ruby

Installing Ruby is like getting the player before you can play a video. Your computer needs Ruby installed so it can understand and run Ruby programs.

In this page:

  1. Installing Ruby

Installing Ruby

Ruby needs to be installed before you can run any Ruby script, and it's available on Linux, macOS, and Windows through various installers.

Most developers use a version manager like rbenv or rvm to switch between Ruby versions per project, rather than a single system-wide install. Package managers like apt, brew, and choco also provide direct installs.

Note: Run ruby -v after installing to confirm the interpreter is on your PATH.

Example: Installing Ruby

bash
# Linux (Ubuntu/Debian)
sudo apt-get update && sudo apt-get install -y ruby-full

# macOS (Homebrew)
brew install ruby

# Windows (Chocolatey)
choco install ruby

# Verify installation (all platforms)
ruby -v

⚠️ Run this in your own terminal or Node.js environment.

Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
Common Mistakes
  1. Using the system Ruby on macOS for projects, which is old and needs permissions; a version manager such as rbenv or Homebrew Ruby is safer.
  2. Installing a gem with sudo gem install, which can cause permission problems later.
  3. Skipping ruby -v after installing, so a wrong or missing PATH is only found when a script fails.
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.