Tutorials  /  Linux Basics

Ruby Programming on Windows: A Step-by-Step Guide for Beginners

Ccentron Redaktion · January 2025 ·4 min read ·Linux Basics, Tutorial

Ruby is a dynamic programming language you can use to write anything from simple scripts to games and web applications. It was first released in Japan in 1993, but gained popularity in 2005 as a language for server-side web development. Ruby is designed to be easy to use and fun for beginners, but powerful enough to create complex systems. It’s a great choice for beginners and experienced developers alike.

While there are many ways to set up Ruby on Windows, Microsoft recommends that you use the Windows Subsystem for Linux (WSL) and Bash to do your Ruby development. WSL is a Windows 10 feature that lets you run native Linux command line tools on Windows. Many Ruby libraries are designed to run on Linux, and can exhibit problems when run on Windows.

Microsoft partnered with Canonical and other Linux distributions to enable native support for the Bash shell and Linux command line tools to solve this issue. With Bash and WSL installed, you’ll edit your files with your favorite Windows tools, but use Bash and command line tools to execute Ruby and its related tools.

Prerequisites

You will need a computer running Windows 10 with the Creators Update, and access to install software with administrative privileges.

VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Step 1 — Installing Bash on Windows

You’ll use the command line to install and work with Ruby. The command line is a non-graphical way to interact with your computer. Instead of clicking buttons with your mouse, you’ll type commands as text and receive text-based feedback. The command line, also known as a shell, lets you automate many tasks you do on your computer daily, and is an essential tool for software developers.

Windows offers two command line interfaces out of the box: the classic Command Prompt, and PowerShell. We’re going to install Bash, a popular shell and command language that you’d find on Linux and macOS.

First, enable Developer mode on your machine. To do this, open the Settings app, select Update & Security, and then choose the For developers entry in the sidebar. Then check the Developer mode option and accept the prompt asking you to verify this change.

Next, open the Control Panel and select Programs. Then select Turn Windows features on or off. In the list of components that appears, check the option for Windows Subsystem For Linux (Beta). Then click OK and wait while Windows installs the additional components, which may take a few minutes.

When the computer reboots, open the Command Prompt and type:

Code
bash

Step 2 — Installing RVM and Ruby

RVM automates the process of setting up a Ruby environment on an Ubuntu or macOS system, and since the Bash setup you’re running is based on Ubuntu, this is the quickest way to set things up on Windows as well. Let’s get it installed so we can use it to install Ruby.

Code
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Install the gnupg2 package:

Console
sudo apt-get install gnupg2

Download RVM installation script:

Code
\curl -sSL https://get.rvm.io -o rvm.sh

Step 3 — Creating a Simple Program

Let’s create a small “Hello, World” program to verify the setup.

Code
puts "Hello, World!"

Run the program:

Code
ruby hello.rb

Conclusion

With your local machine ready for software development, you can continue to learn more about coding in Ruby.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Unser Team hilft Ihnen bei Ihrem konkreten Setup weiter – von Menschen, die die Plattform selbst betreiben.

War dieses Tutorial hilfreich?

Ihre Antwort wird anonym gespeichert und hilft uns, die Tutorials zu verbessern.

Kommentare

Noch keine Kommentare – stellen Sie die erste Frage zu diesem Tutorial.

Zum Kommentieren anmelden

Kommentare stehen centron-Kunden offen. Melden Sie sich in Ihrem Konto an, um eine Frage zu diesem Tutorial zu stellen.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren