Lesson Weekend

Students using PC machines with Windows tend to run into a lot of problems installing all the tools necessary for the Ruby/Rails program. Why? There is no "one size fits all" installation setup for Windows machines. Installations are often riddled with errors and it can take some serious persistence to get Ruby set up on a Windows machine.

Fortunately, we have a few installation options to choose from, some of which make running Ruby/Rails much easier on a Windows machine.

One option is to use a tool called Docker to containerize our applications. A container has everything we need to run our application - the complete set of tools and processes to for our development environment. Whenever we introduce important new tools in the Ruby/Rails course, we'll provide the basic scaffolding for an application with a Docker configuration so that you can easily use Docker to containerize your Ruby, Sinatra, and Rails configurations. Other than having Docker installed on your local machine, there's no other installation needed (including Postgres)!

Using Docker ultimately decreases requirements for software installation and troubleshooting, version management, and debugging complex environment issues. We dive into the details of Docker, containerization, and the benefits of learning and using this tool in Introduction to Docker. Please know that using Docker is entirely optional, but this is our recommended approach. This is probably the easiest way for students using a Windows machine to take the Ruby/Rails course.

To install Docker, follow the instructions in Installing Docker, and then work through the pre-work in the Docker with Ruby Pre-Work.

Please know, this curriculum is in beta. Even though this will be our recommended approach going forward, challenges may come up. You can always use one of the other options below as well, and you can switch to and from using Docker at any point in the coursework.

Linux: Challenging

If you are interested in Linux or have previous experience with using it, you can also consider using the Windows Subsystem for Linux. It is much easier to set up all the tools you'll need for Ruby within the Windows Subsystem for Linux. The downside, however, is that you'll need to teach yourself quite a bit about Linux! We don't provide Linux support at Epicodus so this option is best for students that are motivated to learn Linux on their own. You will actually need to have WSL to use Docker, so you can always try both if you're really interested.

Installing Ruby and Rails on Windows: The Way We've Always Done It

The following installation instructions cover what you need to do to set up all the Ruby tools you need on your Windows machine. Keep in mind that our instructions are broad because there's no "one size fits all" installation setup for Windows machines. You will very likely run into problems - frustrating problems - and instructors won't be able to provide additional support to debug your personal configuration. This is the approach we used for many years - so it does work - but we've provided content on Docker to get around the issues that students often face running a Ruby environment with Windows.

On Windows, the easiest way to install Ruby is with the RubyInstaller, which includes Ruby and a few other tools we'll use throughout these lessons. Make sure to install the Ruby+Devkit 2.6.6-2 version, to have a compatible version with the tools used in the curriculum. There is both a 64 bit (x64) and 86 bit (x86) version available. The built-in System Information program on Windows machines has information on which version your machine is using. Because the instructions on where to find this information vary based on your Windows version, if you don't know how to find this information, we recommend a quick Google search to determine with version you should download.

If you have trouble installing Ruby on your computer, you can try an online development environment like SourceLair. We also recommend reading through terminal output and any error logs that come up in the installation process, as they can point what to look into that may be missing.

After installing Ruby, you might run into issues using Ruby on the command line. Enable this for future lessons with the following:

$ echo $'alias irb=\'winpty "$(which irb).cmd"\'' >> ~/.bash_profile

Then, verify that you can install Rails:

$ gem install rails -v 5.2.0

Then, verify that Rails is working by navigating to the desktop and creating a new project:

$ rails new test_project

It will take a little time for Rails to spin up a new project. After you confirm the project has been created, delete the test_project directory.

Not sure whether to install Ruby or use Docker?

Or perhaps you have questions about the benefits and drawbacks of working with Docker instead of installing Ruby? Read through the FAQ: Should I Install Ruby or Use Docker?.

Lesson 4 of 8
Last updated October 13, 2021