0Pricing
Ruby Academy · Lesson

Managing Dependencies with Bundler

Learn how to manage gem dependencies using Bundler and the Gemfile.

Managing Dependencies with Bundler is a free Ruby Academy lesson on CoddyKit — lesson 3 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

Managing Dependencies with Bundler

Bundler is a tool that manages gem dependencies in Ruby projects.

It ensures that all required gems are installed and compatible with each other.

Managing Dependencies with Bundler — illustration 1

2

What is Bundler?

Bundler ensures that your project has all the necessary gem dependencies.

It uses a Gemfile to define which gems should be installed.

3

Installing Bundler

To install Bundler, use the following command:

gem install bundler

4

Creating a Gemfile

The Gemfile is used to specify required gems for a project.

Create a new file named Gemfile and add:

source 'https://rubygems.org'

gem 'nokogiri'

5

Installing Gems from the Gemfile

Once you have a Gemfile, install the listed gems using:

bundle install

6

Understanding Gemfile.lock

Bundler creates a Gemfile.lock file to lock gem versions.

This ensures consistency across different environments.

7

Specifying Gem Versions

In a Gemfile, you can specify gem versions:

gem 'rails', '~> 6.1.4'

8

9

Running a Ruby Script with Bundler

To ensure your script uses the correct gem versions, run:

bundle exec ruby my_script.rb

10

Congratulations!

You have learned how to manage gem dependencies using Bundler.

Next, you will learn how to create your own Ruby gem.

Managing Dependencies with Bundler — illustration 10

Frequently asked questions

Is the “Managing Dependencies with Bundler” lesson free?

Yes — the full text of “Managing Dependencies with Bundler” 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 “Managing Dependencies with Bundler”?

Learn how to manage gem dependencies using Bundler and the Gemfile. 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 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Managing Dependencies with Bundler” 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