Appendix A. Installation guide

 

Before you can get started building Rails applications, you need to spend some time setting up your development environment. This means installing Ruby, and Rails, on your operating system of choice.

There are various tools you can use to do so, and there’s no “best” or “perfect” solution. This guide covers the installation of our two preferred tools—ruby-install for installing different versions of Ruby from source, and chruby for switching your installed versions of Ruby easily. Then we’ll look at using those tools to install Ruby and Rails, and then spin up a new working Rails app.

Windows

It’s a bit tedious to set up Ruby and Rails on Windows. Windows doesn’t have a package manager built in, and it doesn’t have support for some native gems. But Ruby development is still possible, and for the purposes of this book, it’s perfectly fine to use Windows.

Tested with ...

This section has been verified with Windows 8.1, Ruby 2.1.6, and Rails 4.2.1.

We’ll install Ruby via RubyInstaller, and then install DevKit, which enables you to build many of the C/C++ extensions available.

Ruby versions

Although RubyInstaller has a version that includes Ruby 2.2.2, many of the basic gems such as sqlite haven’t been updated to be compatible with this newer version of Ruby under Windows. All of the code samples in this book will work just fine with Ruby 2.1, so if you’re on a Windows machine, stick to using Ruby 2.1.

RubyInstaller

Mac OS X

Linux