Skip to main content

Tutorial on how to install Ruby, Ruby on Rails and how to use Ruby Gems

You already heard about Ruby on Rails and how easy it is to quickly develop working applications. However, the process of creating new software requires a few building blocks and understanding how to handle them efficiently.

The first step is, of course, installing Ruby itself. As the number of your projects will surely quickly increase, managing multiple variants of Ruby can become quite unpleasant. To help with that, the open source community prepared multiple version managers, with most popular ones being rbenv and rvm.

How to install Ruby on Mac?

Both rvm and rbenv are available for MacOS and popular Linux distributions, so the whole process comes down to pasting a few command lines into the console.

rbenv

1. With Homebrew installed, run init in your Terminal (and if you don’t have it, you can install rbenv with GitHub checkout):

$ brew install rbenv

2. After it is done, type:

$ rbenv init

3. This will prompt a guide on how to set up the shell. Usually, it’s enough to just add one line to .zshrc or .bash_profile:

$ echo 'eval "$(rbenv init -)"' >> ~/.zshrc

4. Now everytime Terminal is opened, rbenv should be up and ready to work.

$ source  ~/.zshrv

5. Finally, it’s time to install actual Ruby. Now it’s as simple as the providing version number after the install command:

$ rbenv install 2.7.0
$ rbenv global 2.7.0

6. To set the local version to use, just type in:

$ rbenv local 2.7.0

rvm

If you have already installed Ruby using rbenv, your work is complete. Rvm is an alternative tool to do the same thing and generally it’s not a good idea to use them both at the same time — besides, there really is no point.

Installing rvm is quite similar to rbenv, and again, there are only few commands that need to be run in the console:

1. Let’s start with adding PGP keys:

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

2. Then fetching rvm and installing the latest version of Ruby just after that:

$ curl -sSL https://get.rvm.io | bash -s stable --ruby

3. Different versions of Ruby can be quickly downloaded and installed with the install command, just like so:

$ rvm install 2.7.0

It’s important to mention that in your project directory, you can create a .ruby-version file (simple text file with the Ruby version number). Based on this file both rbenv and rvm will try to use the proper Ruby version or will prompt installing the missing one.

How to install Ruby on Windows?

If you are using Windows, the best option is to use RubyInstaller. Just get the .exe file for the desired Ruby version and start the installation. RubyInstaller can be combined with MSYS2 (a port of the Unix development toolset) and MinGW libraries, providing a great development environment.

Ruby installation check

After installation, you can check version with:

$ ruby -v

And see where the interpreter is located:

$ which ruby

Ruby is an interpreted programming language. To run the code, it’s enough to just point to the .rb file and hit execute:

$ ruby app.rb

Along with the interpreter comes the Interactive Ruby Shell (irb) which executes Ruby commands as you type them in real time:

$ irb
irb(main):001:0> 2+2
=> 4

What is RubyGems?

The standard Ruby installation comes with Ruby Core API and Standard Library API, which are used to write Ruby applications. A simple application could be written from scratch using those APIs, but when it comes to something more complex, it is best to use Ruby packages provided in the Package Manager. Ruby has one called RubyGems and the packages are called gems. 

RubyGems comes with a command-line utility called a gem. It installs gems from specified public or private repositories. Another thing worth mentioning is https://rubygems.org/, which hosts many gems from the Ruby community. Typically, a gem delivers new libraries with particular functionalities and, sometimes, command-line tools. 

RubyGems comes with the standard Ruby installation, so there’s no need to install anything else.

How to use Ruby Gems?

Let’s see how to work with gems. This command will print the RubyGems settings with info where the gems are installed:

$ gem env

Gems install / uninstall

To install and uninstall gems, type:

$ gem install gem_name (-v version to specify gem version)
$ gem uninstall gem_name

Gems update

To update specific gem, run:

$ gem update gem_name

Or all gems:

$ gem update

Gems list

Gems are installed in a local repository. To list installed gems type:

$ gem list

While installing gems all dependencies are installed along with the gem.

Ruby Bundler

During project development you can discover that your project requires more and more gems. Installing them all manually with the gem command would be difficult if not impossible to match all dependencies. There is a smart tool that is used to manage all gems in a project — the Bundler.

Install Bundler and specify gems for the project

It comes as a gem, so first install it:

$ gem install bundler

Then create a Gemfile in your project root directory with the content:

source ‘https://rubygems.org’ gem ‘rails’, ’6.0.2.1’ gem ‘rspec’

Install gems with Bundler

To install, type:

$ bundle install

It will install all the gems with the specified version and their dependencies. If you want to use another gem in your project, then add it to the Gemfile and run the bundle install again.

Update gems with Bundler

If you want to update some gems for your project, change the version in the Gemfile and again, run:

$ bundle install

To update specific gem, run:

$ bundle update gem_name

Or for all gems:

$ bundle update

In either case, Bundler will resolve the dependencies.

How to use Ruby on Rails?

After all the installations and settings it’s time to start a new Ruby on Rails project and set up a couple of things. 

Install Rails

No surprise here — Rails comes with a gem:

$ gem install rails

It will install the newest Rails with some other gems Rails depends on. Rails itself has a command-line utility which could be used to create a new Ruby on Rails application.

Check the version and help messages which describe options for creating a new app.

$ rails -v
$ rails -h

New Rails application

To create a Rails project type with default options:

$ rails new my_amazing_rails_app

That command will generate the whole project structure under my_amazing_rails_app directory. You will see the output of creating application files and then Bundler will install all dependencies from the newly created Gemfile. 

Next, enter my_amazing_rails_app directory and start a  Rails server.

$ cd my_amazing_rails_app
$ rails server

This will run a web server Puma, which is used by Rails applications by default. The default port is 3000. Go to your browser and enter http://localhost:3000 and you should see Rails welcome page.

How to set up a Ruby on Rails development environment?

The default database used by Rails is SQLite. If you want to use different DB from the beginning, you can provide the DB from the following option:

$ rails new my_amazing_rails_app —database postgresql

The database configuration is located in the config/database.yml file. Rails runs the application within the specified environment (for starting app locally environment called “development” is used as default). To provide your DB settings, edit the development settings in config/database.yml. 

Another often used option is api, which configures the application with limited middleware, only for API-like applications.

$ rails new my_amazing_rails_app —api

Rails generates a lot of files. In the app directory, you will find the main files for the application. As Rails was created following the MVC (Model-View-Controller) pattern, you will find there are files for models, controllers and views in appropriate directories. In the config directory, you will find configuration files for the application, environments, the database, routes, etc. In the db directory, you will find the DB schema and migration files.

Where to go next?

There are many of Rails tutorials and guides. Just to mention one https://guides.rubyonrails.org/, which describes most of Rails features with examples. Ruby and Rails APIs are well documented. Just create a new app, create a model, a controller and a view for it, and you might fall in love with Rails!

If you are interested in Ruby on Rails development, read our article to find out why it’s worth learning Ruby on Rails.

Published on March 20, 2020

Share

Published on March 20, 2020


Jan GrelaJan GrelaRuby on Rails Developer

Digital Transformation Strategy for Siemens Finance

Cloud-based platform for Siemens Financial Services in Poland

See full Case Study
Ad image
Ruby on Rails - guide
Don't miss a beat - subscribe to our newsletter
I agree to receive marketing communication from Startup House. Click for the details

You may also like...

Senior programmers pair-programming on a complex backend service implementation
Computer programmingTech StackDelivery Models

Software Programming Services

Programming services are only as valuable as the architecture and process wrapped around them. This guide sets out the pillars of high-impact programming, how to choose a technology stack, and the delivery models that have replaced simple hourly billing. It follows the lifecycle of a programming project, covers infrastructure and platform engineering, and reviews vertical-specific expertise. Advanced trends, common outsourcing pitfalls and a method for calculating ROI complete the guide.

Alexander Stasiak

Alexander Stasiak

Aug 19, 2026・9 min read

Outsourced programming team working alongside an in-house product team on shared sprint goals
Software OutsourcingComputer programmingCooperation Models

Outsourcing Programming Services

Outsourcing programming has shifted from a cost lever to a way of injecting specialist skill exactly when a roadmap needs it. This guide defines what outsourcing programming services covers, why startups and enterprises choose it, and how the main cooperation models differ in practice. It provides an evaluation method for candidate partners and walks the delivery process from discovery to launch. Sections on platform engineering, risk mitigation, ROI and future trends round out the analysis.

Alexander Stasiak

Alexander Stasiak

Aug 10, 2026・8 min read

Node.js developers building scalable backend services for modern web applications
Node.jsBack-end developmentProgressive Web Apps

Node.js Development Service

Node.js enables fast, scalable, and real-time applications. Our Node.js development services help businesses build secure, high-performance backends designed for growth.

Alexander Stasiak

Alexander Stasiak

Feb 05, 2026・10 min read

Demystifying Procedural Programming: Simple Examples for All
Computer programmingDigital products

Demystifying Procedural Programming: Simple Examples for All

Explore procedural programming with easy-to-follow examples and insights into its core principles. Learn how this step-by-step approach forms the basis of many programming paradigms.

Marek Pałys

Marek Pałys

Jul 05, 2024・10 min read

Business team collaborating with external outsourcing partner for growth strategy
Digital productsRuby on Rails

Understanding the Basics: BaseModel vs ActiveRecord Validator in Rails

BaseModel and ActiveRecord Validator are essential tools in Rails for ensuring data integrity. While BaseModel centralizes complex shared logic, ActiveRecord Validator offers straightforward, built-in validation for individual attributes. Discover their differences and when to use each for efficient Rails development.

Marek Pałys

Marek Pałys

Oct 10, 2024・8 min read

UX designer working on SaaS application interface for scalability
Ruby on RailsDigital products

The Ultimate Guide to Ecommerce Platforms Built on Ruby on Rails

Ruby on Rails powers some of the best ecommerce platforms, offering efficiency, scalability, and flexibility for online stores. This guide covers top Rails ecommerce platforms, their features, and how they simplify ecommerce development. Build your online store with the power of Ruby on Rails.

Alexander Stasiak

Alexander Stasiak

Oct 08, 2024・8 min read

Recently added

Glass paper airplane flying through a chrome ring, symbolizing a fast, automated leasing application
FinTechAutomationCase Study

How Startup House Cut Leasing Applications to 2 Minutes for Siemens Financial Services

Leasing used to mean paperwork, manual credit checks, and decisions that waited for office hours. For Siemens Financial Services Poland, Startup House replaced that with SimplyLease Online: an application customers complete in about 2 minutes and an automated credit decision delivered in about 7, at any hour. This case study shows how the platform was built within Siemens Group security standards, how it connects to Siemens systems and external data providers, and what a partnership running since 2016 has delivered. It closes with three lessons that apply to almost any financing or lending product.

Alexander Stasiak

Alexander Stasiak

Oct 06, 2026・5 min read

Glass shield of four stacked layers with a glowing green core, symbolizing an AI agent embedded in a cybersecurity platform
AI AgentsCybersecurityCase Study

How a Cybersecurity Platform Serving Fortune 500 Clients Cut Onboarding by 95% with an AI Agent Built by Startup House

A cyber risk platform trusted by Fortune 500 companies had a familiar problem: customers respected it but opened it once a quarter, and onboarding took 45 minutes of guided setup. Startup House built Aria, an AI agent embedded inside the product, with a four-layer interface that serves board members, CFOs, and CISOs in one panel. Onboarding dropped by 95% to under 2 minutes, data exploration became fully self-serve, and the platform turned into a daily decision-support tool. This case study explains the interface, the tenant-isolation architecture, and why none of it required touching the platform's core codebase.

Marek Pałys

Marek Pałys

Oct 05, 2026・5 min read

Five glass measuring cylinders filled with violet and green liquid to different levels, symbolizing measurable project outcomes
Business OutcomesCase StudyAI Projects

AI and Digital Projects by Startup House: 5 Measurable Outcomes in Numbers

Claims are easy in software development, so this article sticks to numbers. It walks through five outcomes from Startup House client projects, from a 95% cut in onboarding time with an embedded AI agent to a 40% reduction in development costs for Omnipack. Each section says what kind of work produced the number and links to the public case study behind it. The closing section names three patterns these projects share, worth borrowing whether or not you work with us.

Alexander Stasiak

Alexander Stasiak

Oct 04, 2026・5 min read

Glass medical capsule inside a protective glass sphere with a chrome ring, symbolizing compliance-first healthcare software
HealthtechHIPAA ComplianceAI in healthcare

Healthtech Software Development at Startup House: Compliance-First Projects and Results

In healthcare software, compliance is either an architecture decision or a retrofit. This article shows what designing it in from day one looks like across three Startup House projects: a sales platform for Siemens Healthineers active in more than 60 countries, a dementia care MVP shaped by 7 user testing sessions with patients and caregivers, and Doogie, a HIPAA-grade AI showcase built in 2 months. It also explains how RAG keeps clinical AI answers traceable to verified sources, and why patient data is never used to train models. For MedTech companies and health SaaS platforms, it is a practical look at what compliance-first engineering means beyond the label.

Marek Pałys

Marek Pałys

Oct 03, 2026・5 min read

Two projects, one method: how phased delivery and real user testing took Graspify to live corporate training and gave LITTLEWINE an investor-ready scope.
Edtech transformationProduct discoveryAI In Education

Edtech Development at Startup House: What We've Built and What It Changed

EdTech platforms fail for UX reasons more often than technical ones: learners drop off, content doesn't scale, and ROI stays invisible. This article shows how Startup House avoids that with phased delivery and real user testing, using two projects as proof. Graspify went from a bold idea to a microlearning platform that trained hundreds of employees during a corporate event, and LITTLEWINE got an investor-ready scope from 10 user interviews in 2 weeks. It also covers AI learning tools that answer only from approved content and can go live in as little as 2 weeks.

Alexander Stasiak

Alexander Stasiak

Oct 02, 2026・5 min read

Glass and chrome balance scale holding green glass coins and a chrome padlock, symbolizing speed and control in fintech AI
FinTechAI in FinanceRegulatory Compliance

AI in Fintech: Startup House Projects, Lessons, and Outcomes

Fintech customers expect consumer-grade speed, while regulators expect bank-grade control. This article shows how Startup House has handled that tension in three projects: automated 24/7 credit decisions for Siemens Financial Services, a cyber risk platform that grew revenue 150% in a year, and a climate fintech team for CHOOOSE assembled in 2 weeks. Each project comes with the lesson it taught us. The article closes with five rules for AI in finance, from grounding every answer in verified data to designing tenant isolation into the architecture.

Marek Pałys

Marek Pałys

Oct 01, 2026・5 min read

Ready to centralize your know-how with AI?

Start a new chapter in knowledge management—where the AI Assistant becomes the central pillar of your digital support experience.

Work with a team trusted by top-tier companies.

Siemens logo
PwC logo
Toyota logo