How to Uninstall a Ruby Gem

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.

Features can be added to the Ruby programming language by downloading and installing special packages called gems. These packages are fetched from a central repository by a program named "gem," which normally comes with Ruby. Most Ruby programmers are immediately familiar with the steps needed to install a Ruby gem, but may not be familiar with how to remove gems that are no longer needed from the system. This can be accomplished using a special command of the Gem package manager.

Advertisement

Step 1

Open a terminal. In Windows, you can do this by clicking "Start" and "Run." When the "Run" dialog appears, type "cmd." On Mac OS X, you can simply click the Spotlight button and type "Terminal."

Video of the Day

Step 2

Type the following command to uninstall a gem:

Advertisement

gem uninstall GEMNAME

Replace "GEMNAME" with the name of the gem you would like to install.

Advertisement

Step 3

Answer any prompts given by the uninstall command. Depending on the configuration of the gem itself, you may be asked to specify the versions to uninstall or asked to confirm the uninstallation. In addition, the uninstall may fail if the gem detects that other gem packages depend on the one you wish to uninstall.

Video of the Day

Advertisement

Advertisement

references