The easy way to install Ruby on Windows
This is a self-contained Windows-based installer that includes the Ruby language, an execution environment, important documentation, and more.

Latest News
RubyInstaller 3.2.2-1, 3.1.4-1, 3.0.6-1 and 2.7.8-1 released
RubyInstaller versions 3.2.2-1, 3.1.4-1, 3.0.6-1 and 2.7.8-1 are released. These are maintenance releases with bug and security fixes. See the ruby-3.2.2 release post, ruby-3.1.4 release post, ruby-3.0.6 release post and ruby-2.7.8 release post for more details about the ruby core update.
RubyInstaller 3.2.1-1 released
RubyInstaller version 3.2.1-1 is released. It is a maintenance releases with bug fixes.
RubyInstaller 3.2.0-1 released
RubyInstaller-3.2.0-1 has been released! It features a whole bunch of great new features and improvements. See the ruby-3.2.0 release post for more details. A noticeable addition to Ruby on Windows is the support of UNIXSocket.
RubyInstaller 3.1.3-1, 3.0.5-1 and 2.7.7-1 released
RubyInstaller versions 3.1.3-1, 3.0.5-1 and 2.7.7-1 are released. These are maintenance releases with bug and security fixes. See the ruby-3.1.3 release post, ruby-3.0.5 release post and ruby-2.7.7 release post for more details about the ruby core update.
RubyInstaller 3.1.2-1, 3.0.4-1, 2.7.6-1 and 2.6.10-1 released
RubyInstaller versions 3.1.2-1, 3.0.4-1, 2.7.6-1 and 2.6.10-1 are released. These are maintenance releases with bug and security fixes.
Is RubyInstaller for you?
RubyInstaller is the easiest and most widely-used Ruby environment on Windows. And Ruby is a great language for beginners as well as professionals. It’s suitable for small scripts as well as large applications. RubyInstaller combines the possibilities of native Windows programs with the rich UNIX toolset of MSYS2 and the large repository of MINGW libraries. RubyInstaller is a great foundation for using Ruby for development and production … Read more
Learn Ruby
Online Ruby Programming Course
If you’re new to Ruby, check out this online course from The Pragmatic Studio to learn all the fundamentals of object-oriented programming with Ruby.
Online Rails Programming Course
If you’re looking to create Ruby on Rails web apps, you’ll learn how to build a complete Rails 4 app step-by-step in this online course also from The Pragmatic Studio.
Contribute
How can I help the project?
Install Ruby On Rails on
Windows 10
In this guide, we will be installing Ruby on Rails on Windows 10.
We’re going to use the Windows Subsystem for Linux (WSL) to accomplish this. This allows you to install a Linux distribution natively on Windows without a virtual machine.
Ruby on Rails will always be deployed to a Linux server, so it’s best for us to use the same for development.
Installing the Windows Subsystem for Linux
Windows allows you to run various Linux operating systems inside of Windows similar to a virtual machine, but natively implemented. We’ll use this to install Ruby and run our Rails apps.
You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.
Open Powershell and run:
wsl --install -d Ubuntu

Reboot your computer to finish the installation.
Once initial setup is finished, you will be prompted to create a username and password for your Ubuntu install.
You can search for «Ubuntu» in the Windows Start Menu anytime to open the Ubuntu terminal.
Congrats! You now have Ubuntu installed on Windows with WSL. You’ll use this to run your Rails server and other processes for development.
Installing Ruby
The first step is to install dependencies for compiling Ruby. Open your Terminal and run the following commands to install them.
sudo apt-get update sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev
Next we’re going to be installing Ruby using a version manager called ASDF.
The reason we use ASDF over rbenv, rvm or others is that ASDF can manage other languages like Node.js too.
Installing asdf is a simple two step process. First you install asdf , and then add it to your shell:
cd git clone https://github.com/excid3/asdf.git ~/.asdf echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc echo 'legacy_version_file = yes' >> ~/.asdfrc echo 'export EDITOR="code --wait"' >> ~/.bashrc exec $SHELL
Then we can install ASDF plugins for each language we want to use. For Rails, we can install Ruby and Node.js for our frontend Javascript.
asdf plugin add ruby asdf plugin add nodejs
Choose the version of Ruby you want to install:
To install Ruby and set the default version, we’ll run the following commands:
asdf install ruby 3.2.2 asdf global ruby 3.2.2 # Update to the latest Rubygems version gem update --system
Confirm the default Ruby version matches the version you just installed.
which ruby #=> /home/username/.asdf/shims/ruby ruby -v #=> 3.2.2
Then we can install the latest Node.js for handling Javascript in our Rails apps:
asdf install nodejs 20.9.0 asdf global nodejs 20.9.0 which node #=> /home/username/.asdf/shims/node node -v #=> 20.9.0 # Install yarn for Rails jsbundling/cssbundling or webpacker npm install -g yarn
Configuring Git
We’ll be using Git for our version control system so we’re going to set it up to match our Github account. If you don’t already have a Github account, make sure to register. It will come in handy for the future.
Replace my name and email address in the following steps with the ones you used for your Github account.
git config --global color.ui true git config --global user.name "YOUR NAME" git config --global user.email "YOUR@EMAIL.com" ssh-keygen -t ed25519 -C "YOUR@EMAIL.com"
The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.
cat ~/.ssh/id_ed25519.pub
Once you’ve done this, you can check and see if it worked:
ssh -T git@github.com
You should get a message like this:
Hi excid3! You've successfully authenticated, but GitHub does not provide shell access.
Installing Rails
Choose the version of Rails you want to install:
gem install rails -v 7.1.1
Now that you’ve installed Rails, you can run the rails -v command to make sure you have everything installed correctly:
rails -v # Rails 7.1.1
If you get a different result for some reason, it means your environment may not be setup properly.
Setting Up PostgreSQL
For PostgreSQL, we’re going to add a new repository to easily install a recent version of Postgres.
sudo apt install postgresql libpq-dev sudo service postgresql start
You’ll need to start postgresql each time you load your WSL environment.
The postgres installation doesn’t setup a user for you, so you’ll need to follow these steps to create a user with permission to create databases. Feel free to replace chris with your username.
sudo -u postgres createuser chris -s # If you would like to set a password for the user, you can do the following sudo -u postgres psql postgres=# \password chris
Final Steps
Let’s create your first Rails application on Windows!
rails new myapp -d postgresql #### Or if you want to use MySQL rails new myapp -d mysql # Then, move into the application directory cd myapp # If you setup MySQL or Postgres with a username/password, modify the # config/database.yml file to contain the username/password that you specified # Create the database rake db:create rails server
You can now visit http://localhost:3000 to view your new website!
Getting an «Access Denied» error?
If you received an error that said Access denied for user ‘root’@’localhost’ (using password: NO) then you need to edit the config/database.yml file to match the database username and password.
Editing Code
Install VS Code on Windows and install the WSL extension. This will allow you to edit code in Windows but run commands and extensions in WSL. Read more about Developing in WSL.
That’s it! Let us know in the comments below if you run into any issues or have any other protips to share!
Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.
Solutions
- Rails Tutorials
- Rails for Beginners course
- Rails Courses
- Rails SaaS Template
- Deploy Ruby on Rails
- Ruby on Rails Jobs
Установка Ruby — Ruby: Настройка окружения
Начнем с установки Ruby и знакомства с REPL.
Если на вашем компьютере пока не стоит Ruby, то выполните установку по нашей инструкции . После установки перезагрузите компьютер.
Теперь убедимся в том, что Ruby установился и работает. Откройте терминал и наберите в нем следующую команду:
# Ваша версия может отличаться ruby -v ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin21]
Интерактивный запуск кода
Если все прошло удачно, можно запустить код на Ruby через REPL.
REPL (Read Eval Print Loop) — это программа, которая работает как командная оболочка. Она:
- Ожидает ввод от пользователя (Read)
- Выполняет введенный код (Eval)
- Печатает на экран результат (Print)
- Затем снова входит в режим ожидания (Loop)
Чтобы запустить REPL, наберите в терминале команду irb :
# IRB расшифровывается как Interactive RuBy irb irb(main):001:0>
> 1 + 5 6 > 7 % 2 1
Такой способ помогает быстро проверять гипотезы, отлаживать код и делать простые вычисления.
REPL позволяет использовать переменные и запоминает предыдущий ввод:
> a = 5 5 > b = 10 10 > a + b 15
Чтобы выйти из REPL, воспользуйтесь одним из двух вариантов:
- Наберите exit и нажмите Enter
- Нажмите CTRL + D
Запуск кода из файлов
Для полноценной разработки REPL уже не подходит — в нем становится неудобно. Поэтому на практике разработчики записывают код в обычные текстовые файлы на своем компьютере.
Какой редактор для этого использовать? Сейчас самым распространенным и удобным редактором для кода считается VS Code . Скачайте его, установите и поизучайте интерфейс. У него много встроенных возможностей, которые расширяются плагинами.
Откройте редактор, создайте в нем файл с именем index.rb и следующим содержимым:
puts 'Hello, Hexlet!';
VS Code имеет встроенные механизмы, которые запускают код автоматически. Но пока вы только учитесь, поэтому стоит научиться запускать код вручную.
Для этого откройте терминал в той директории, где вы создали файл в редакторе. В терминале выполните такую команду:
# Сначала перейдите в директорию с файлом index.rb
Открыть доступ
Курсы программирования для новичков и опытных разработчиков. Начните обучение бесплатно
- 130 курсов, 2000+ часов теории
- 1000 практических заданий в браузере
- 360 000 студентов
Наши выпускники работают в компаниях:
Шаг 1. Настройка среды разработки для разработки на языке Ruby
Чтобы разработать приложение с помощью драйвера Ruby для SQL Server, необходимо настроить среду разработки, учитывая необходимые условия.
Драйвер Ruby использует протокол TDS, включенный по умолчанию в SQL Server и Базу данных SQL Azure. Дополнительная настройка не требуется.
Windows
- Скачайте установщик Ruby
Если на вашем компьютере не установлен язык Ruby, установите его. Для новых пользователей Ruby рекомендуется использовать установщики Ruby 2.2.X, которые предоставляют стабильный язык и обширный список совместимых и обновленных пакетов (gems). Перейдите на страницу загрузки Ruby и скачайте соответствующий установщик 2.1.x. Например, если вы используете 64-разрядный компьютер, скачайте установщик Ruby 2.1.6 (x64). - Установите Ruby
Завершив скачивание установщика, выполните следующие шаги:
а. Дважды щелкните файл установщика, чтобы запустить его.
b. Выберите язык и примите условия.
c. На экране параметров установите флажки рядом с параметром «Добавить исполняемые файлы Ruby в путь» и «Связать файлы .rb и .rbw с этой установкой Ruby». - Скачайте набор разработки Ruby
Скачайте набор разработки со страницы RubyInstaller - Установите набор разработки Ruby
После завершения загрузки выполните следующие действия:
а. Дважды щелкните файл. Вам будет предложено извлечь файлы.
b. Нажмите кнопку «. » и выберите «C:\DevKit». Вероятно, вам потребуется сначала создать эту папку, нажав кнопку «Создать папку».
c. Нажмите кнопку «ОК», а затем «Извлечь», чтобы извлечь файлы. - Откройте cmd.exe
- Инициализируйте набор разработки Ruby
> chdir C:\DevKit > ruby dk.rb init > ruby dk.rb install
> gem inst tiny_tds
Ubuntu Linux
- Откройте терминал
- Установите диспетчер версий Ruby ( rvm ) и предварительные требования
> sudo apt-get --assume-yes update > command curl -sSL https://rvm.io/mpapis.asc | gpg --import - > curl -L https://get.rvm.io | bash -s stable > source ~/.rvm/scripts/rvm
- Установите Ruby с помощью rvm
Например, установите версию Ruby 2.3.0:
> rvm install 2.3.0 > rvm use 2.3.0 --default > ruby -v
Убедитесь, что выходные данные последней команды показывают, что вы используете версию 2.3.0.
> sudo apt-get --assume-yes install freetds-dev freetds-bin
> gem install tiny_tds
macOS
Примечание. В macOS уже установлен Ruby, так как операционная система имеет зависимость.
> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
> brew install FreeTDS
> gem install tiny_tds
