Install Rails
After setting up your development environment and installing Ruby, it’s easy to install Rails. It’s just a gem!
Check for the current version of Rails. Rails 7.0.1 was released January 6, 2022. Please note that Rails 7.0.0 requires Ruby 3.0.3 and cannot be used with Ruby 3.1). You'll need Rails 7.0.1 if you are using Ruby 3.1.
Here are the options you have for installing Rails.
If you want to install the current stable release:
$ gem install rails
If you want the newest beta version or release candidate, you can install with --pre.
$ gem install rails --pre
Or you can get a specific version.
For example, if you want the Rails 5.2.4 release:
$ gem install rails --version=5.2.4
🚩 After installation, close and re-open the terminal window.
Verify that the correct version of Rails is installed with rails -v
.
$ rails -v
Rails 7.0.1
If you get a warning, Ignoring ... because its extensions are not built. Try: gem pristine ...
, close and re-open the terminal window to start a new terminal session and try again.
Rails is now installed. If you want, you can close the Terminal window. Everything is installed, so you won't lose anything by closing the Terminal.
Next, try building a Rails application.