0Pricing
Ruby Academy · Lesson

Installing and Using Gems

Discover how to install gems using gem install and include them in your projects.

Installing and Using Gems is a free Ruby Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ruby Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

1

Installing and Using Gems

Ruby gems allow developers to easily add functionality to their applications.

In this lesson, you will learn how to install and use gems in your Ruby projects.

Installing and Using Gems — illustration 1

2

Installing a Gem

Use the gem install command to install a gem.

gem install nokogiri

3

Requiring a Gem in Your Code

After installing a gem, you must require it in your Ruby script.

require 'nokogiri'
puts 'Nokogiri gem loaded successfully!'

4

Installing a Specific Version of a Gem

You can install a specific gem version by specifying it.

gem install rails -v 6.1.4

5

Uninstalling a Gem

To remove an installed gem, use:

gem uninstall nokogiri

6

Updating All Gems

To update all installed gems to the latest versions, run:

gem update

7

Checking a Gem’s Usage

To find out where a gem is installed and its details, use:

gem which nokogiri

8

9

Installing Gems Globally or Locally

By default, gems are installed globally. To install a gem for a specific user only, use:

gem install nokogiri --user-install

10

Congratulations!

You have learned how to install, use, and manage Ruby gems.

Next, you will explore how to manage gem dependencies with Bundler.

Installing and Using Gems — illustration 10

Frequently asked questions

Is the “Installing and Using Gems” lesson free?

Yes — the full text of “Installing and Using Gems” is free to read here on the web, and the Ruby Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ruby Academy course, upgrade to CoddyKit PRO.

What will I learn in “Installing and Using Gems”?

Discover how to install gems using gem install and include them in your projects. You practise Ruby Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Ruby Academy?

No prior experience is required. Ruby Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Installing and Using Gems” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Ruby Academy lesson?

Yes. Every Ruby Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Are Gems?
  2. Installing and Using Gems
  3. Managing Dependencies with Bundler
  4. Creating Your Own Gem
← Back to Ruby Academy