6 mins read

Install Ruby on Rails on Windows: A Complete Guide

Learn how to install Ruby and Rails on Windows with this complete step-by-step guide. Setup Ruby, Rails, SQLite, and manage Gems with ease.
Blog Image

Raisa Kanagaraj

Technical Content Writer

Blog Image

Ruby on Rails (often called just “Rails”) is a popular framework for building modern web applications. While most Rails developers prefer macOS or Linux, many beginners and professionals still use Windows as their primary development environment. If you’re one of them and wondering how to install Ruby on Windows and set up Rails properly, this guide is for you.

We’ll walk through every step of the Ruby installation on Windows, Rails setup, and required configurations. By the end, you’ll have a working Rails environment ready for development.

Why Install Ruby on Windows?

Ruby is a dynamic, open-source programming language that powers the Rails framework. Having a local Ruby and Rails environment on Windows allows you to:

  • Learn Ruby and Rails without switching to another OS.
  • Develop and test Rails applications locally.
  • Use RubyGems (libraries and dependencies) with ease.
  • Explore frameworks, packages, and developer tools available in the Ruby ecosystem.

While Windows isn’t Rails’ native environment, there are tools like the Ruby Installer for Windows, and it has become much easier to get everything running smoothly.

Step 1: Download Ruby Installer for Windows

The easiest way to begin is to use the official Ruby Installer for Windows, which bundles Ruby, required dependencies, and a development kit.

  • Go to the official site: RubyInstaller.org
  • Download the latest stable version (choose Ruby+Devkit). For most users, the 64-bit version is recommended.
  • Run the installer. During installation: a. Check the option to “Add Ruby executables to your PATH.” b. After installation, the setup will ask to run ridk install. Accept this to install MSYS2 and development toolchain.

Command (when prompted by the installer):

ridk install

This step installs important dependencies, which Rails and native Gems rely on.

You now have Ruby installed on your Windows system.

Step 2: Verify Ruby Installation

Open Command Prompt (cmd) or PowerShell and type:

ruby -v

If everything went well, you should see the Ruby version:

ruby 3.2.2p53 (2023-03-30 revision 12345) [x64-mingw32]

This confirms that your Ruby install was successful.

Step 3: Install Rails

Rails is a RubyGem, which means you can install it using the built-in gem command.

Run:

gem install rails

This downloads and installs Rails and its dependencies. Depending on your internet speed, this might take a few minutes.

Once installed, verify with:

rails -v

Expected output:

Rails 7.1.0

You now have Rails installed on your Windows machine.

Step 4: Install SQLite3 (Database for Rails)

Rails uses a database, and by default, it works with SQLite3 for local development. The Ruby Installer for Windows usually sets this up, but if not, you can install it manually:

  1. Download SQLite3 precompiled binaries from SQLite.org.
  2. Extract and copy the files (sqlite3.exe, sqlite3.dll) into your Ruby bin folder (e.g., C:\Ruby32-x64\bin).

Verify installation:

sqlite3 --version

Step 5: Create Your First Rails Application

Now that Ruby and Rails are installed, let’s create a new Rails project.

rails new myapp

cd myapp

To start the Rails server:

rails server

Open a browser and go to:

http://localhost:3000

If you see the default “Rails Welcome” page, congratulations! Your setup is working perfectly.

Step 6: Manage Gems and Dependencies

Ruby uses Gems (packages or libraries) to extend functionality. When working on Rails projects, you’ll use dozens of Gems for authentication, testing, API integration, etc.

A key challenge with Rails projects is Gem compatibility, particularly during upgrades to new Rails versions. A newer Rails version may not support some older Gems, and vice versa.

This is where a tool like RailsUp can help.

Using RailsUp – The Gems Compatibility Checker

RailsUp is a free tool developed by RailsFactory that helps developers check if their Gems are compatible with newer versions of Rails.

Before upgrading your Rails app or adding a new Gem, you can run a compatibility check with RailsUp to:

  • Ensure your Gems work with the target Rails version.
  • Avoid dependency conflicts.
  • Save time troubleshooting version mismatches.

You can try RailsUp here: RailsUp – Free Gems Compatibility Checker

This is especially important when you’re upgrading Rails on Windows, where certain Gems may need additional system dependencies.

Common Issues and Fixes

Installing Ruby on Windows is straightforward, but you might run into some hiccups. Here are common ones:

1. Rails Installation Fails with Native Extensions

Some Gems need to be compiled from source. If you skipped the ridk install step during Ruby installation, you may face errors. Run:

ridk install

and retry.

2. SSL Certificate Issues

If you get SSL-related errors when installing Gems, update RubyGems and SSL certificates:

gem update --system

gem install rubygems-update

3. SQLite3 Gem Error

If you see errors related to sqlite3, ensure the SQLite binaries are in your PATH and reinstall the gem:

gem install sqlite3 --platform=ruby

Step 7: Optional – Install Node.js and Yarn

Rails 7 introduced import maps, but if you’re using JavaScript frameworks (React, Vue, Angular), you’ll need Node.js and Yarn.

  1. Download Node.js from nodejs.org and install it.
  2. Install Yarn via npm:

npm install --global yarn

Check versions:

node -v

yarn -v

Step 8: Use a Code Editor

For Rails development on Windows, Visual Studio Code is the most popular editor. Install it from code.visualstudio.com.

Recommended extensions:

  • Ruby
  • Rails
  • Ruby Solargraph (for code intelligence)

Step 9: Best Practices for Ruby Installation on Windows

  • Always use the latest stable Ruby version to avoid compatibility issues.
  • Run gem update regularly to keep dependencies fresh.
  • Use Bundler (installed with Rails) to manage project-specific Gems:

bundle install

  • Before upgrading Rails, use RailsUp to check Gem compatibility.

Conclusion

Installing Ruby and Rails on Windows is much easier today than it used to be. This is because of tools like Ruby Installer for Windows and tools like MSYS2. With just a few steps, you can:

  1. Install Ruby on Windows with RubyInstaller.
  2. Install Rails and verify the setup.
  3. Configure SQLite and dependencies.
  4. Start building your first Rails app.

Remember, managing Gems is a crucial part of any Rails project. Use the RailsUp Gems Compatibility Checker to save yourself from dependency headaches and ensure smoother upgrades.

With Ruby and Rails now running on your Windows machine, you’re ready to dive into application development.

Pro Tip: If you plan to grow into production-grade projects, consider using Linux (via WSL on Windows or a VM). But for learning and small to medium projects, Windows works perfectly fine with the steps in this guide.

Ready to start building? Go ahead and try your first Rails project today!

Written by Raisa Kanagaraj

Your one-stop shop for expert RoR services

Join 250+ companies achieving top-notch RoR development without increasing your workforce.

Book a 15-min chat