Install Ruby on Rails 5.0 on macOS, Ubuntu, or Windows. Up-to-date, detailed instructions on how to install the Rails newest release. How to install Rails 5.0, the newest version of Rails. These installation guides are used by professional developers to configure their working environment for real-world Rails development. If You Are New to Rails. Installing Rails is as simple as running the following command in your Terminal: gem install rails -v 6.0.2.2. Rails is now installed, but in order for us to use the rails executable, we need to tell rbenv to see it: rbenv rehash. And now we can verify Rails is installed: rails -v # Rails 6.0.2.2. If you've been itching to try out Ruby and/or Rails, if the Terminal is somewhat new to you, you may find that even the process of installing it can generate countless confusing errors. This article will detail the exact steps you need to follow to get Ruby up and running on your Mac. Learn to install all of the software necessary for developing projects in Ruby on Rails, the popular web application framework. This course is designed for developers and other users who want to install and configure Ruby on Rails 5 on their Mac.
Mac has basically Ruby. So, you can install Rails directly, but to support various versions of Ruby, we’ll install rbenv that is ruby version manager. Execute the command below to install rbenv. Brew install rbenv ruby.
(Related article: How to Install Ruby on Rails for Mac OSX Mavericks)
Ruby On Rails Download
For this post we are based on a clean “Ubuntu 14.04 LTS” installation, nevertheless I have installed these tools in previous versions with the same steps. And similar steps should work in other Linux ditros.
For day to day Ruby on Rails development work we need several tools to be porperly installed and running:
- Git: Right now this is the standard Version Control System in the industry. Even more!! I work with git in all my client projects since a few years ago.
- Rbenv (and ruby): lightweight Ruby Version Manager to isolate Ruby versions and project dependencies.
- Rails: Our favourite framework to build Web apps.
- Sublime Text Editor: lightweight modern editor.
- PostgreSQL: Probably the best Database in the open source market (in fact my favourite)
For Ubuntu my first recommendation, before to make a big installation, is updating system packages:
Install Ruby On Rails For Mac
Step 1. Installing Git
Git is the standard VCS for the Ruby community, and probably for the IT industry at this moment. Also it is pretty simple to install at Ubuntu:
Git will need your email and name at least to identify your commits, but I have added some other configurations interesting for my day-to-day work. Execute each line in prompt:
Probably you will use Github to deliver code to your clients, and it will need to identify you through your ssh-keys. You can follow this guide in order to create ssh keys (if you do not have them yet) and configure your account.
This process is similar with other Git providers like Bitbucket or your Company owned Git servers.
Step 2. Dynamic prompt with Git and ANSI colors
Tobias Sjösten wrote a pretty useful article explaining this.
This hack will:
- Put our current branch in prompt
- Change color if there are files to commit
This gives you a quick status of your changes in project in a quick eye-shot. You just have to add the following code to ~/.bash_profile file:
You should restart terminal for these changes to take effect.
Step 3. Install Ruby with RBENV
RVM and RBENV are the most used Ruby Version Managers among developers. Rbenv is lighter and solves the dependency isolation problem working with Bundle (the default dependency management gem for Rails).
RBENV give us several advantages:
- The obvious ‘apt-get install ruby’ is outdated, and you probably want to work with latest ruby versions.
- Allow different versions of ruby in the same machine, which will be useful when we write code in different projects.
- Dependency isolation working with bundle.
You need Git that was installed previously to install RBENV.
With commands above you have installed Rbenv and the ruby versions builder, and give access to them directly from command prompt. Please, restart your terminal to load Rbenv.
The only disadvantage of BINSTUBS is that you have to remember to run the following command
Now, you can install every ruby version with a command:
Step 4. Your first Rails App
First you need to install Rails gem:
Create your new app:
Go to Gemfile and uncomment this line:
The gem “Therubyracer” is Google V8 engine wrapped in a gem, in order to have the capability of evaluating JavaScript code from Ruby. Pretty interesting in Rails templates and assets.
After that re-install gems:
And start it in your browser at http://localhost:3000
Step 5. Set Up Sublime Text as Code Editor
There are several code editors in the market to edit ruby code: SublimeText, RubyMine, Aptanta,…. Or Opensource like vim, gedit or emacs. Sublime Text is an excellent choice if you want a lightweight editor with great features and a modern user interface.
Download and unzip last version from the web page. In order to give access from command prompt:
Now you can open your Rails app by typing:
The convention for Ruby programs is to use two spaces as indentation. You can follow Sublime Text 2 => Preferences => Settings - User and add these lines.
Step 6. PostgreSQL installation
This is a pretty good Database and maybe this will be your Production relational database. So worth it to take a look at how to integrate it with rails:
You can add the gem to your Gemfile:
And run bundle again: bundle install, to make PG gem installation.
After that your Database config file should be like:
Extra Ball. Set up RubyMine

Here at Tealeaf Academy we recommend Sublime for our students, because is lighter and easy to use. But if you need a more complete editor: with debugger, Git or Ticketing System integration, plugins … . RubyMine is a great choice.
You need a Java Runtime installation before:
Download and install:
They allow you a 30 day trial version, after that you should purchase a license.
Then you can open every Rails application within the project folder with the command:
Conclusion
Well, this is just the beginning. Here we just installed our Dev environment with a bunch of really useful tools, which you will use in your day-to-day work.
If you want a structured, instructor led program to level up to a professional level Ruby on Rails developer, check out our curriculum!
by Daniel Kehoe
Last updated 9 November 2016
Install Ruby on Rails 5.0 on macOS, Ubuntu, or Windows. Up-to-date, detailed instructions on how to install the Rails newest release. How to install Rails 5.0, the newest version of Rails.
These installation guides are used by professional developers to configure their working environment for real-world Rails development.
If You Are New to Rails
If you’re new to Rails, see What is Ruby on Rails?, the book Learn Ruby on Rails, and recommendations for a Rails tutorial.
What is the RailsApps Project?
This is an article from the RailsApps project. The RailsApps project provides example applications that developers use as starter apps. Hundreds of developers use the apps, report problems as they arise, and propose solutions. Rails changes frequently; each application is known to work and serves as your personal “reference implementation.” Support for the project comes from people who purchase the Capstone Rails Tutorials.
What’s New in Rails
To stay informed of new releases, subscribe to Peter Cooper’s Ruby Weekly newsletter and follow @ruby_news and @rails_apps on Twitter.

Rails 5.0
Rails 5.0.0 was released June 30, 2016.
Notable additions in Rails 5.0 include an option for an API-only application suitable for use as a backend to JavaScript or mobile applications. Also Action Cable for live features such as chat and notifications.
Learn more about Rails 5.0:
What You Need to Know: Rails 5.0 is the current stable version. Upgrade older projects to Rails 5.0 now. See the article Updating to Rails 5.0 and Upgrading to Rails 5 Beta.
Earlier Releases
For an overview of earlier releases, see a Ruby on Rails Release History.
MacOS

Upgrade to macOS Sierra (10.12) before installing Ruby. MacOS comes with a “system Ruby” pre-installed. MacOS Sierra includes an earlier Ruby version which is not the newest version. For flexibility during development, don’t use the system Ruby. Instead, install Ruby using RVM, the Ruby Version Manager.

See this article for complete instructions:
Before installing Ruby, you’ll need to prepare your computer by installing Apple’s Xcode Command Line Tools.
What You Need to Know: Upgrade to macOS Sierra and install Apple’s Xcode Command Line Tools. Then use RVM to install Ruby.
Ubuntu Linux
On Ubuntu, package managers are available to install Ruby. For Ubuntu Linux, it is best to install RVM, the Ruby Version Manager, to install Ruby and Rails. The package managers are often not up to date. Use RVM instead.
Since Rails 3.1, a JavaScript runtime has been needed for development on Ubuntu Linux (it is not needed for macOS or Windows). For development on Ubuntu Linux it is best to install the Node.js server-side JavaScript environment.
See this article for complete instructions:
What You Need to Know: Use RVM to install Ruby and Rails. And install a JavaScript runtime.
Hosted Development
Cloud9 provides a “hosted development environment.” That means the service provides a computer you use from your web browser. Accounts are free for small projects.
The web interface includes a browser-based file manager and text editor, plus a Unix shell with Ruby and Rails pre-installed. Any computer can access the hosted development environment, though you’ll need a broadband connection.
See this article for complete instructions:
What You Need to Know: Use Cloud9 if you don’t want to install Ruby on your computer.
Install Ruby On Rails Mac Mojave
Windows
Developing with Rails on Windows can be painful. Some gems requiring native extensions may be difficult to install. For this reason, most developers use macOS or Ubuntu to develop Rails applications.
Here are your choices for Windows:
- Use the Cloud9 hosted development environment
- Install the Railsbridge Virtual Machine or rails-dev-box
- Use RailsInstaller for Windows as documented in Installing Rails on Windows
Cloud9 is ideal if you have a fast Internet connection. If not, download the Railsbridge Virtual Machine or rails-dev-box for a virtual Linux computer with Ruby 2.0 and Rails 4.0 using Vagrant. The last option, RailsInstaller, is not recommended because it does not provide an up-to-date version of Ruby or Rails. Also, RVM does not run on Windows.
What You Need to Know: Use Cloud9, the Railsbridge Virtual Machine, or switch to macOS or Ubuntu Linux if you can.
Where to Get Help
Your best source for help with problems is Stack Overflow. Your issue may have been encountered and addressed by others.
