How to create a Gemfile?

The Gemfile is just a text file within your project which contains a list of gems for use in your application.

If you do not have one in your application, you can create the file using an editor of your choice, saving it as Gemfile (with no extension), and in your example, containing:

source 'https://rubygems.org'

gem 'rspec'

bundle init generates a Gemfile into the current working directory.

$ bundle init
Writing new Gemfile to /app/Gemfile

$ cat Gemfile 
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# gem "rails"

Tags:

Ruby

Rspec