Ruby is a dynamic, object-oriented programming language celebrated for its elegant syntax, developer-friendly design, and productivity. Best known for powering the Ruby on Rails web framework, Ruby is widely used in web development, automation, DevOps, and scripting. Its clear structure and strong community support make it a favorite among developers who prioritize readability and efficiency.
This guide will walk you through installing Ruby on Windows, setting up a version manager like uru or using the official RubyInstaller, and configuring tools like Bundler to manage your gems and project dependencies. Whether you’re building a simple utility or a full-scale web application, Ruby makes it easy to get started and enjoyable to keep going on Windows.
Before installing Ruby on Windows, make sure your system is up-to-date and that you have administrative access to install new software. RubyInstaller for Windows comes with everything you need, including the Ruby language, development tools, and MSYS2—a minimal Unix environment required for building native C extensions.
You don't need to manually install dependencies like compilers or make utilities. RubyInstaller handles these as part of the setup. However, having a basic text editor (like VS Code, Sublime Text, or Notepad++) ready will make writing and editing Ruby code much easier.
The easiest way to install Ruby on Windows is by using RubyInstaller, which bundles Ruby with a development toolkit and an optional MSYS2 environment for native extensions.
Download the latest Ruby+Devkit version from the official site:
https://rubyinstaller.org/
After downloading, run the installer and follow these steps:
ridk install
This command sets up MSYS2, which is necessary for building native Ruby gems on Windows.
rbenv and RVM are not designed for Windows, and they do not run natively. Instead, version management for Ruby on Windows is typically done using one of the following options:
For most users, installing a single version of Ruby via RubyInstaller is sufficient. If you need to manage multiple versions, consider setting up WSL and using Linux-based tools inside that environment.
Once you've installed Ruby using RubyInstaller, it's important to verify that everything was set up correctly. Open a new Command Prompt or PowerShell window and run:
ruby -v
You should see the installed Ruby version printed out (e.g., ruby 3.2.2p53
). You can also check the location of your Ruby installation by running:
where ruby
If these commands return valid output, your Ruby installation is working properly.
Ruby uses a package manager called RubyGems to install and manage libraries (called gems). Bundler is a tool that works alongside RubyGems to manage dependencies for your projects.
To install Bundler, run the following command:
gem install bundler
This will allow you to manage your project's gem dependencies using a Gemfile
. If you're using RubyInstaller with DevKit, native gems will compile correctly thanks to the built-in MSYS2 environment.
IRB is Ruby’s interactive shell—a great place to experiment with code, test ideas, or learn Ruby syntax. To launch it, open Command Prompt or PowerShell and type:
irb
You’ll get a prompt where you can enter and evaluate Ruby expressions interactively. Try typing something simple like:
puts "Hello from IRB!"
To exit IRB, type exit
or press Ctrl+D
.
After installing Ruby and verifying it works, you can write your first Ruby script. Open a plain text editor like Notepad, Notepad++, or Visual Studio Code, and enter the following code:
puts "Hello, Ruby on Windows!"
Save the file as hello.rb
. Then open Command Prompt, navigate to the folder where you saved the file, and run:
ruby hello.rb
You should see the message printed in your terminal. Congratulations—you just ran your first Ruby program on Windows!
To make Ruby development more comfortable and productive, consider using a code editor or IDE that supports Ruby syntax highlighting, linting, and debugging. Popular choices include Visual Studio Code, RubyMine, and Sublime Text.
If you're using Visual Studio Code, install the Ruby and Solargraph extensions to enable code completion, formatting, and language server features. You may also want to configure your editor to use UTF-8 encoding and Unix-style line endings for better compatibility across platforms.
To create a basic Ruby project on Windows, start by creating a new folder for your project, such as my_ruby_project
. Inside that folder, you can create a file like main.rb
and begin writing your Ruby code.
If you're planning to manage dependencies, create a Gemfile
and list any required gems. You can then run bundle install
to set everything up (assuming you’ve installed Bundler). Organizing your project this way prepares it for future growth, testing, and sharing.
Once you’ve completed the setup and written your first script, the next step is to start exploring Ruby’s standard library and common gems. Try building simple CLI tools or explore frameworks like Sinatra or Rails for web development.
Great learning resources include the official [Ruby documentation](https://ruby-doc.org/), the free book Learn to Program by Chris Pine, and online platforms like RubyMonk, Exercism, and The Odin Project. Joining the Ruby community through forums or local meetups can also help accelerate your learning journey.