Ruby is a dynamic, object-oriented programming language known for its simplicity and productivity. Installing Ruby on Windows has become much easier over the years, with several reliable methods available. This guide will walk you through the most effective ways to get Ruby up and running on your Windows system.
Before installing Ruby, ensure your Windows system meets these requirements:
RubyInstaller is the easiest and most popular way to install Ruby on Windows. It provides a complete Ruby development environment with minimal configuration required.
.exe
file in your Downloads folderC:\Ruby32-x64
)After the main Ruby installation completes:
Open Command Prompt or PowerShell and run:
ruby --version
You should see output similar to:
ruby 3.2.0 (2022-12-25 revision a528908271) [x64-mingw-ucrt]
Also verify gem installation:
gem --version
WSL provides a Linux environment within Windows, offering a more Unix-like Ruby development experience.
Run the following command:
wsl --install
Restart your computer when prompted
Update package lists:
sudo apt update
Install Ruby and development tools:
sudo apt install ruby-full build-essential
Check Ruby version in WSL:
ruby --version
gem --version
If you have Chocolatey installed:
Install Ruby:
choco install ruby
If you prefer Scoop:
Install Ruby:
scoop install ruby
Bundler is essential for managing Ruby gem dependencies:
gem install bundler
If you plan to work with Ruby projects from Git repositories:
Configure your Git username and email:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Consider installing a Ruby-friendly code editor:
Create a simple Ruby script to test your installation:
hello.rb
Add the following content:
puts "Hello, Ruby World!"
puts "Ruby version: #{RUBY_VERSION}"
puts "Platform: #{RUBY_PLATFORM}"
Run the script:
ruby hello.rb
If you receive a “command not found” error:
If you encounter SSL errors when installing gems:
gem update --system
Or download the SSL certificate manually:
gem install --http-proxy http://proxy.server:port gem_name
Ensure you have the DevKit installed (included with RubyInstaller). For manual installation:
Initialize and install:
cd path/to/devkit
ruby dk.rb init
ruby dk.rb install
For managing multiple Ruby versions, consider using rbenv-win:
Use commands like:
rbenv install 3.2.0
rbenv global 3.2.0
rbenv local 2.7.0
Regularly update Ruby and gems:
gem update --system
gem update
Always use a .ruby-version
file in your projects to specify the Ruby version:
3.2.0
Use Gemfiles for dependency management:
source 'https://rubygems.org'
gem 'rails', '~> 7.0'
gem 'sqlite3', '~> 1.4'
Installing Ruby on Windows is straightforward with the right tools. RubyInstaller remains the most beginner-friendly option, providing everything needed for Ruby development in a single package. For developers seeking a more Unix-like environment, WSL offers excellent compatibility with Ruby and its ecosystem.
Once installed, you’ll have access to Ruby’s powerful features and the vast RubyGems ecosystem. Whether you’re building web applications with Rails, automation scripts, or exploring Ruby’s elegant syntax, you now have a solid foundation to start your Ruby programming journey on Windows.
Remember to keep your Ruby installation updated and explore the rich ecosystem of gems available through RubyGems. Happy coding!