How to install a beta version of Rails
This article will show you how using the gem command you can install beta versions of Rails
Eager to try out Rails 6 but don’t know how to start a new project with it? This short guide will help.
When you run
gem install foo Ruby will install the latest stable version of the gem. Normally this is exactly what you want.
If you want to play with an alpha or beta version of a gem, you need to add some extra information.
Just give me the absolute newest thing
If you want to blindly install the very latest version of the gem, which in this case we do. Then you can run
gem install rails --prerelease.
Command line tools like
gem use what we call flags to set specific options when calling the tool.
--prerelease flag tells
gem install to install the latest version of the gem, regardless of stable status.
The rest of the article assumes you want to play with a prerelease version, but still have some control over the exact version you want.
Enter the version flag
gem install comes with a whole host of interesting flags. You can find out more about them by typing
gem install --help into your console. (side note:
--help is a really common flag that lots of tools use to show the help page).
The flag we’re interested in is the version flag. Which is
--version or can be abbreviated to just
When we pass
--version to the
gem install command we can specify an exact version of a gem to install. In our case we want the beta version of Rails.
Finding out the latest version of a gem
The easiest way to find out the versions that are available for you to install is to visit rubygems.org and search for the gem you want the information for.
If you don’t want to leave the command line, you can do it with just the
gem tool as well.
gem list rails --remote --prerelease -e is the command I would run to list all of the prerelease versions of Rails.
--remote flag tells gem to look over at rubygems.org instead of just looking at which gems I have installed locally.
--prerelease flag I would just see the latest official version.
Because rails is such a common gem name (
rails_blah) I also had to pass in
-e which stands for exact.
At the time of writing this article, the latest version of Rails is
This is what we can pass into our
gem install command, giving us:
gem install rails --version 6.0.0.beta1
Checking which version of Rails you are about to use
You will almost certainly have at least one other version of Rails installed for a specific version of Ruby. If you want to double check which version of Rails is going to run when you type
rails new my_awesome_project you can!
gem which rails will tell you exactly where the
rails app lives, part of that information includes the version.