Site icon Treehouse Blog

How to Install Rails 5 on Windows

While setting up for the Treehouse Rails 5 Basics course, we’re also updating our installation help workshops to cover Rails 5. We figured we’d share those directions here, as a little nudge for those of you who still haven’t discovered how awesome Rails is.

We’ve set up guides for 3 different operating systems:

We’re not going to mess with installing a fancy database, alternate testing frameworks, or anything like that; this is an easy, bare-bones installation that will let you try Rails and see if it’s right for you.

Ready? Let’s get started!

Ruby

First, we need an installation of the Ruby programming language. We’re going to use a precompiled version of Ruby called Ruby Installer.

Ruby Development Kit

At this point, we could attempt to install Rails. But some of the libraries Rails depends on need some “build tools” in order to be compiled, and Windows lacks those tools by default. (You’ll know this is happening if you see an error when attempting a Rails install: “Gem::InstallError: The ‘[gem name]’ native gem requires installed build tools.”) To fix this, we need to install the Ruby “Development Kit”, which includes those build tools.

Now we need to make the DevKit tools available to Ruby.

The DevKit should now be available for your Ruby tools to use when installing new libraries.

Rails

Now it’s time to install Rails. Rails comes as a Ruby “gem”. A gem is a library, a collection of reusable code, that can be automatically downloaded and installed on your system, using the “gem” tool. In your command prompt, type:

gem install rails --version 5.0.0

This will ensure you’re downloading the correct version of the gem. Once you press Enter, the “gem” program will download and install that version of the Rails gem, along with all the other gems Rails depends on.

Node.js

One last thing. . . Some libraries that Rails depends on require a JavaScript runtime to be installed. Let’s install Node.js so that those libraries work properly.

Once your computer restarts, don’t forget to go to the Windows menu, click “All Programs”, scroll down to Ruby, and click “Start Command Prompt with Ruby”.

That’s it!

You should be ready to create your first Rails app!

You’ll want to check out our Rails 5 Basics course for an in-depth guide to getting started. Rails is a powerful, productive framework, and after you play with it a bit, we’re betting you’ll love it.

Start learning to code today with a free trial on Treehouse.

Exit mobile version