banner image 1 banner image 2

Installation of Custom Gem File into your Ruby Project

March 16, 2023
5 mins
blog-img 1
Vishnuram R

This article mainly discusses “Installation of custom Ruby gem file to your Ruby Project” using three Different Techniques. It also discusses about the .gem file and some commands to work with the file and components present in the gem file.

By Vishnuram R — “The Creative Dreamer

What is a .gem File?

The package could include Ruby applications and libraries, saved as a “Filename.gem” (in a self-contained format) format. Each gem has a name, version, and platform. Platforms are determined by the type of operating system, the Processor architecture, and occasionally the operating system version. The platform indicates the gem only works with a ruby built for the same platform. The appropriate version for your platform will be downloaded automatically by RubyGems.

Installation of Custom Gem file into Ruby Project

The Ruby Gem file can be a custom gem file that you can create or we can install a gem using the gem install command which downloads and installs the gem and necessary dependencies. You can also install specific versions of the package by including -v in your command line.

$gem install “gem package name” -v “Version number”

You can check whether the gem is installed by using the list command which lists the locally installed gem, there you can check whether the required gem is installed.

$gem list

gem list
gem List

You can Uninstall a gem using uninstall command which helps to uninstall a gem library you specified and you can also uninstall a specific gem version by including -v in your command line

$gem uninstall “package name” -v “Version number”

What are components present in the .gem file?

Components in .gem File

bin Directory contains an executable file, which will be loaded into the user’s PATH when the gem is installed.

lib Directory contains the code for the gem

• The Rakefile, which the rake program uses to automate tests, generate code, and perform other tasks.

• The README File contains the Documentation of the gem. Most gems include RDoc documentation, but some use YARD documentation also.

• The gemspec, which contains information about the gem. The gem’s files, test information, platform, version number, and more are all present here along with the author’s email and name.

test Directory contains the test code for the gem whether it works and does its job

A Custom Gem can be installed in your Ruby Project in 3 Different Ways

1. Installation of Custom gem Using Github Sources

The Gem file can be installed using GitHub sources. You can specify the gem name and path of the GitHub source in the GemFile and install them using the git install command or bundle install

For Example:

gem ‘rails_admin’, :git => ‘git://’

When you are trying to install a gem from an unreachable source you cannot install the gem using bundle install. You can follow these steps to install the gem from GitHub sources

• Download the files from the GitHub source

• Place the files in a Directory in your Ruby Project

• Add the gem name and path to your Gemfile,

For Example

gem ‘rails_admin’, :path => “vendor/gems/rails_admin”

• Run Bundle Install and you can find the gem is being installed in your Ruby Project. You can verify by listing the installed gem ($gem list)

2. Installation of Custom Gem by publishing to

You can publish your gem file to and install the gem to your Ruby program. You can do this by following the steps:

  • First you should set up the computer with your RubyGems account. If you have an account you can run the command $gem signin . If you do not have an account then you can create one and set it up in your computer
Installation of Custom Gem by publishing to
Installation of Custom Gem by publishing to

• After setting up in your computer, you can publish the gem to by executing the command $gem push “Filename”.gem

• After publishing the gem to your gem will be available to install by anyone.

• Then you can use $gem install “gem name” and install the gem to your Ruby program.

3. Installation of Custom Gem from .gem file

If you have a .gem file downloaded locally on your computer then you can install the gem file by following the steps

• First place your .gem file in a directory of your Ruby program after downloading them locally on your computer.

• Navigate to the Directory where you have placed your .gem file after downloading

• Execute command $gem unpack “Filename”.gem

• After executing the command without throwing any errors you can find a directory similar to the file name of the .gem file.

• Inside the directory you can find the list of components that are present in the .gem file

• Then you must add the gem name and path in the Gemfile(File that is created to describe the gem dependencies required to run a Ruby program) of your Ruby program.

• You can install this gem by $gem install “gem name” or $bundle install to install the gem to your Ruby program.

. You can check whether the gem is installed properly by listing them $gem list

Ruby Programming Language is widely used in different fields of development and with lots of features available for easy integration and feature development. RubyGems are libraries or Packages which are used in development of new features and these packages can be custom developed packages by an individual or organisation and can be installed by following any of the methods mentioned in the article.




Meet The Team!!


Vishnuram R


Harinniy Gopikannan & Kripa K


Seema Jain

We at CaratLane are solving some of the most intriguing challenges to make our mark in the relatively uncharted omnichannel jewellery industry. If you are interested in tackling such obstacles, feel free to drop your updated resume/CV to!
blog-img 2


blog-img 3
5 mins
May 17, 2023
Sharing Data Between Controllers: Best Practices S...

This article will help you to understand the diffe

By Naveen C

blog-img 3
5 mins
March 21, 2023
Understanding Auto Layout and Constraints in Swift...

This article gives you an easy way of understandin

By Ramasamy P